Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF controls in WinForms [closed]

Tags:

I am new to .NET world and I have little experience of winforms. I want to know whether it is possible to mix WPF with Winforms. I mean can i use WPF controls in traditional windows forms application and are there any compatibility issues? Any reference to a good tutorial would be appriciated.

like image 200
Tausif Baber Avatar asked Feb 15 '11 10:02

Tausif Baber


People also ask

Is WinForms deprecated?

WinForms won't be deprecated until Win32 is ... which could be quite sometime! WPF on the other hand has few direct dependencies on Win32 so could potentially form the basis of a "fresh start" UI layer on a future version of windows.

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.


2 Answers

http://www.codeproject.com/Articles/739902/How-to-Easily-Host-WPF-Control-inside-Windows-Form

You can add the control to your toolbox and add it to your form.

like image 185
Spyder045 Avatar answered Sep 30 '22 14:09

Spyder045


Add a reference to WindowsFormsIntegration and add an ElementHost to you form.

like image 1
Benoit Blanchon Avatar answered Oct 02 '22 14:10

Benoit Blanchon