Getting the handle of parent winform that hosts a wpf control using element host
I have a winfor开发者_如何学编程m application that hosts a wpf control using element host. when I try to use Window.GetWindow(this), null is returned. I want the reference to the parent winform.
You could use the WindowInteropHelper class as follows:
WpfApplication1.Window1 window = new WpfApplication1.Window1();
WindowInteropHelper helper = new WindowInteropHelper(window);
helper.Owner = this.Handle;
window.Show();
More information in this thread
精彩评论