Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
swdev:dotnet:wpf:hosting_windows_forms_controls [2010/11/16 11:47]
smayr created
swdev:dotnet:wpf:hosting_windows_forms_controls [2011/09/07 11:38] (current)
smayr
Line 1: Line 1:
-== Hosting Windows Forms Controls ==+== Hosting Windows Forms Controls in WPF ==
  
 +  * Create a WPF project.
   * Add references to required assemblies:   * Add references to required assemblies:
     * ''WindowsFormsIntegrations''     * ''WindowsFormsIntegrations''
     * ''System.Windows.Forms''     * ''System.Windows.Forms''
 +    * ''System.Windows.Forms.DataVisualization''
 +  * Add namespace in XAML: <code xml>
 +<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" >
 +...
 +</code>
 +
 +  * Add ''WindowsFormsHost'' tag inside a grid element (in XAML), then place the required Windows Form control inside it (eg. an MS Chart control): <code xml>
 +<Grid>
 + <WindowsFormsHost>
 + <charting:Chart x:Name="chart1"/>
 + </WindowsFormsHost>
 +</Grid>  
 +</code>