Walkthrough: Hosting a Windows Forms Control in Windows Presentation Foundation by Using XAML

3. January 2008

How to add a Windows form control to a WPF project in XAML.

  • Add WindowsFormsIntegration assembly to your project
  • Add Windows Forms assembly
  • Now you can use the controls

In your Window add:

xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"

 

Now the controls can be used like:

<WindowsFormsHost>

<wf:MaskedTextBox x:Name="mtbDate" Mask="00/00/0000"/>

</WindowsFormsHost>

 

Source: Link

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Windows Presentation Foundation