AddOwnedForm - 添加 WPF 窗口?
我正在使用现有的 WinForms 表单。我正在尝试与它连接一个新的 WPF 窗口(以替换旧表单)。旧代码称为 mainForm.AddOwnedForm(newForm);
。
我知道这使得新窗体在某种程度上成为主窗体的子窗体——当主窗体隐藏时,它是隐藏的,等等。
有没有办法让我以同样的方式将 WPF 窗口链接到主窗体?
显然,WinForms 不了解 WPF,因此我不期望使用 AddOwnedWindow 方法或任何其他方法。但是有没有办法模拟这个功能呢?
I'm working with an existing WinForms form. I'm trying to interface a new WPF Window with it (to replace an old form). The old code called mainForm.AddOwnedForm(newForm);
.
I know that that makes the new form somewhat of a child of the main form -- it's hidden when the main form is, etc.
Is there a way for me to link a WPF window to the main form in the same way?
Obviously, WinForms doesn't know about WPF, so I'm not expecting an AddOwnedWindow method or anything. But is there a way to emulate this functionality?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想通了。
WindowInteropHelper
会做到这一点:感谢
I figured it out.
WindowInteropHelper
will do it:Thanks to this source.