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

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

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.