This is an old revision of the document!
Hosting Windows Forms Controls in WPF
- Create a WPF project.
- Add references to required assemblies:
WindowsFormsIntegrations
System.Windows.Forms
- Add namespace in XAML:
<Window ... xmlns:winforms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms" xmlns:charting="clr-namespace:System.Windows.Forms.DataVisualization.Charting;assembly=System.Windows.Forms.DataVisualization" Title="MainWindow" Height="350" Width="525" > ...
- Add
WindowsFormsHost
tag inside a grid element (in XAML):<Grid> <WindowsFormsHost> <wf:Chart x:Name="Chart1"/> </WindowsFormsHost> </Grid>