Srinivas Miriyala's Blog


Friday, June 4, 2010

Open a WPF Window from WinForms

using System;
using System.Windows.Forms;
using System.Windows.Forms.Integration;

var wpfwindow= new WPFApplication1.Window1();
ElementHost.EnableModelessKeyboardInterop(wpfwindow);
wpfwindow.Show();

The EnableModelessKeyboardInterop() call is necessary to handle keyboard input in the WPF window if loaded from a non-WPF host like WinForms. I understand there are other ways to do this and you can read more about WPF/WinForms interop here.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home