I have a solution with multiple projects. The principle project is a WinFormsApplication that references a WPF project. I have tried to incorporate a WPF UserControl (defined in the WPF project) that contains CefSharp ChromiumWebBrowser in a Form using ElementHost.
public partial class WebForm : Form
{
private ElementHost elementHostWeb;
public WebForm()
{
InitializeComponent();
elementHostWeb = new ElementHost();
elementHostWeb.Height = this.Height;
elementHostWeb.Width = this.Width;
elementHostWeb.Child = new WebWPFUserControl();
}
}
WPF UserControl:
<UserControl x:Class="WpfApplication.WebWPFUserControl"
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:WpfApplication"
xmlns:cefSharp="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf"
mc:Ignorable="d"
Title="WebWPFUserControl" Height="350" Width="525">
<Grid>
<cefSharp:ChromiumWebBrowser Grid.Row="0"
Address="https://github.com/cefsharp/CefSharp/wiki/Frequently-asked-questions" />
</Grid>
When I tray to open the Form I get the following error: