I have a WinForms menuitem and I need that on menu click the new WPF dialog is loaded. How do I do this? Thanks
+1
A:
You should be able to display it by creating a new instance of the WPF class for the dialog, and then calling its ShowDialog() method.
The only trick is properly setting the owner of the WPF dialog. You can't just set the Owner property directly, since that requires a WPF window. However, you can use the class System.Windows.Interop.WindowInterpHelper to get around this:
MyWpfDialog dialog = new MyWpfDialog();
new System.Windows.Interop.WindowInteropHelper(dialog).Owner = this.Handle;
dialog.ShowDialog();
(I got the code sample from http://blog.stpworks.com/archive/2009/07/02/setting-wpf-dialog-owner-from-within-winforms-application.aspx.)
Andy
2010-09-22 16:07:56