Tutorial :WPF-XAML window in Winforms Application



Question:

I have a Winforms application coded in VS C# 2008 and want to insert a WPF window into the window pane of Winforms application.

Could you explain me how this is done.


Solution:1

You need to use an ElementHost.

ElementHost es = new ElementHost();  es.HostContainer.Children.Add(screen); // where screen is your wpf window or user control    es.Dock = Windows.Forms.DockStyle.Fill; // probably want to fill the element host. Not necessary  somePanel.Controls.Add(es); // add the element host to a panel on your Winform or the form itself  

Hope that helps


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »