Table of Contents

Class BrowserView

Namespace
DotNetBrowser.Wpf
Assembly
DotNetBrowser.Wpf.dll

The Wpf-based implementation of browser view.

public class BrowserView : IBrowserView
Inheritance
BrowserView
Implements
Inherited Members

Examples

<Window x:Class="WpfApp1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp1"
        xmlns:wpf="clr-namespace:DotNetBrowser.Wpf;assembly=DotNetBrowser.Wpf"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800" Closing="Window_Closing">
    <Grid>
        <wpf:BrowserView Name ="BrowserView" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
    </Grid>
</Window>
public partial class MainWindow : Window
{
    private IEngine engine;
    private IBrowser browser;

    public MainWindow()
    {
        try
        {
            Task.Run(() => {
                engine = EngineFactory.Create(new EngineOptions.Builder()
                {
                    RenderingMode = RenderingMode.HardwareAccelerated
                }.Build());
                browser = engine.CreateBrowser();

            }).ContinueWith((t) =>
            {
                BrowserView.InitializeFrom(browser);
                browser.Navigation.LoadUrl("https://www.teamdev.com/");
            }, TaskScheduler.FromCurrentSynchronizationContext());

            InitializeComponent();
        }
        catch (Exception exception)
        {
            Debug.WriteLine(exception);
        }
    }

    private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
    {
        engine.Dispose();
    }
}

Remarks

To bind an instance of this view to a particular browser, use its InitializeFrom(IBrowserView, IBrowser) method:

browserView.InitializeFrom(browser);

This method should be called from the UI thread.

Constructors

BrowserView()

Initializes a new instance of the BrowserView class.

Properties

MenuItems

The collection of the current context menu items.

SaveCreditCardHandler

This handler is used when the user is prompted to save the credit cards in the credit card store, if a different handler was not configured for the browser.

SavePasswordHandler

This handler is used when the user is prompted to save the credentials in the password store, if a different handler was not configured for the browser.

SaveUserDataProfileHandler

This handler is used when the user is prompted to save the user data profiles in the user data profile store, if a different handler was not configured for the browser.

SelectCertificateHandler

This handler is used when the client SSL certificate should be selected, if a different handler was not configured for the browser.

ShowContextMenuHandler

The default context menu handler implementation for this browser view.

StartDownloadHandler

This handler is used when the browser is about to start downloading the file, if a different handler was not configured for the browser.

UpdatePasswordHandler

This handler is used when the user is prompted to update the password in the password store, if a different handler was not configured for the browser.

UpdateUserDataProfileHandler

This handler is used when the user is prompted to update the user data profile in the user data profile store, if a different handler was not configured for the browser.

Methods

OnFocusRequested(object, EventArgs)

This method is used to handle FocusRequested event.