This sample demonstrates how to embed WPFBrowserView into WinForms ElementHost.


The source code of the application form is provided below:

C#

public class MainForm : System.Windows.Forms.Form
{
    public ElementHost Host { get; set; }
    public WPFBrowserView BrowserView { get; set; }

    public MainForm()
    {
        Host = new ElementHost {Dock = DockStyle.Fill};
        BrowserView = new WPFBrowserView() {URL = "teamdev.com/dotnetbrowser"};

        Controls.Add(Host);
        Host.Child = BrowserView; 
    }
}

VB.NET

Public Class MainForm
    Inherits Form

    Public Property Host As ElementHost
    Public Property BrowserView As WPFBrowserView

    Public Sub New()
        Host = New ElementHost With {
            .Dock = DockStyle.Fill
            }
        BrowserView = New WPFBrowserView() With {
            .URL = "teamdev.com/dotnetbrowser"
            }

        Controls.Add(Host)
        Host.Child = BrowserView
    End Sub
End Class