开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜