有没有像Winforms.Show(IWin32Window所有者)在WPF的方法? [英] Is there a method like Winforms.Show ( IWin32Window owner ) in WPF?
本文介绍了有没有像Winforms.Show(IWin32Window所有者)在WPF的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创造,我要被父到另一个现有的应用程序一个新的WPF窗口。我这样做的:
I am creating a new WPF window that I want to be parented to another existing app. I do this with the:
Winforms.Show(IWin32Window所有者)
所有的时间,但由于这个程序是使用WPF窗口,我正在寻找一种方式来达到同样的事情。
all the time, but since this app is using a WPF Window, I am looking for a way to achieve the same thing.
任何想法?
推荐答案
以上的方法是有效的,从一个WPF父窗口这样做是为了一个WPF子窗口
The above way is valid to do this from a WPF parent window to a WPF child window
Window wpfWindow = new Window();
wpfWindow.Owner = this;
如果你想有一个WPF窗户,一个WinForm家长,你需要使用WindowInteropHelper类。
If you want to have a WPF windows with a Winform parent you need to use the WindowInteropHelper class.
WindowInteropHelper helper = new WindowInteropHelper(wpfWindow);
helper.Owner = winFormWindow.Handle.
这篇关于有没有像Winforms.Show(IWin32Window所有者)在WPF的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文