SQL Police
SQL Police

Reputation: 4196

WPF Form within a Windows Forms project

I have an existing Windows Forms project.

Can I create an additional WPF/XAML Window (a full new window) within such a project?

Visual Studio does not offer that option, but I think that should be possible somehow, at least via code?

Upvotes: 6

Views: 1601

Answers (1)

Behzad
Behzad

Reputation: 3580

For this job you must add this references to your Win-Form projects:

  • PresentationCore
  • PresentationFramework
  • WindowsBase
  • System.Xaml

Help link

And to host WPF windows in WinForm or win32 apps you will need this line before you .Show() your Wpf Window:

System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop(myWpfWindow);

See http://msdn.microsoft.com/en-us/library/aa348549.aspx

Helpful link: Mixing WPF and WinForms

Upvotes: 6

Related Questions