I want to use WebKit browser control in my WPF application. However, I am not able to add it in design time. Even if I add the WebKit into toolbox it is disabled state.
My question is how to use that control during design time on WPF form?
Thanks, Omkar
As explained in http://msdn.microsoft.com/en-us/library/ms742735(v=vs.110).aspx , you should first create a WPF grid in your XAML file.
<Grid x:Name="grdBrowserHost">
</Grid>
And add a .NET WebKit in the WPF form by inserting this code into your C# source.
System.Windows.Forms.Integration.WindowsFormsHost host =new System.Windows.Forms.Integration.WindowsFormsHost();
// Create the ActiveX control.
WebKit.WebKitBrowser browser = new WebKit.WebKitBrowser();
browser.Navigate("http://www.google.com");
// Assign the ActiveX control as the host control's child.
host.Child = browser;
// Add the interop host control to the Grid
// control's collection of child controls.
grdBrowserHost.Children.Add(host);
Do not forget to include these references
System.Windows.Forms
WindowsFormsIntegration
in your project.
Hope this help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With