Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embedding a Windows Form into a WPF application

Tags:

c#

winforms

wpf

I have a Old windows form application and i don't want to convert it to wpf , i want to embed it inside my wpf application main window . How can i do this ?.

Also , How Can i transfer text between wpf and embeded WinForm using WindowsFormHost ?

like image 789
rajat Avatar asked Jun 01 '12 12:06

rajat


People also ask

Is it possible to use Windows form in WPF application?

You can use the WindowsFormsHost to add single Forms into an WPF application.

What's the difference between WPF and Windows Forms?

Windows forms are mainly based on a pixel, whereas WPF is not pixel-based, which allows the scalability of the UI part for the application. Windows forms support data binding in a limited way, whereas WPF is fully supported data binding. Windows forms are not used with different themes or skins.

Can I use XAML in Windows Forms?

So, the answer is no : you cannot add an XAML file in a WinForms project as is. You have to create a new System.


1 Answers

You'll want to use a WindowsFormsHost. Check this tutorial out (shows how to do WPF in WinForms and vice versa).

like image 160
Jason Down Avatar answered Oct 01 '22 04:10

Jason Down