A small example showing the hosting of WinForms browser management (with shortcuts disabled) inside a WPF application:
<Window x:Class="how_to_make_winform_run_on_wpf.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms" > <WindowsFormsHost> <wf:WebBrowser WebBrowserShortcutsEnabled="False" Url="http://stackoverflow.com"></wf:WebBrowser> </WindowsFormsHost> </Window>
Of course, you should add links to WinFormsIntegration and System.Windows.Forms assemblies. When using this example, you will notice that all standard WinForms controls use a flat style. To enable WinXP styles for your WinForms controls, put
public App() { System.Windows.Forms.Application.EnableVisualStyles(); }
inside your app.xaml.cs
source share