mfc 和托管 wpf 之间的模式
我在 MFC 应用程序中托管一个 WPF 窗口。我使用 WindowInteropHelper 将 WPF 窗口的所有者设置为应用程序的主 MFC 窗口。问题是当我尝试使用 CDialog::DoModal 在主应用程序中创建并显示模式对话框时,它只是 MFC 窗口的模式对话框。
有趣的是,MessageBox 有一个 MB_TASKMODAL 样式,可以与 WPF 窗口完美配合,但我找不到 CDialog 的类似样式。
我目前有一个解决方法,通过 WindowInteropHelper 获取 WPF 窗口的句柄并将其设置为对话框的父级,然后在调用 DoModal 之前和之后手动禁用并重新启用 MFC 窗口,但这是一个丑陋的黑客行为。
之前有其他人遇到过这种类型的托管 WPF 问题吗?
I am hosting a WPF window inside an MFC application. I'm using WindowInteropHelper to set the Owner of the WPF window to the app's main MFC window. The problem is when I try to create and show a modal dialog box in the main app with CDialog::DoModal, it's only modal for the MFC window.
Interestingly, MessageBox has a MB_TASKMODAL style that works with the WPF window perfectly, but I can't find anything like it for CDialog.
I currently have a workaround that gets the handle to the WPF window through the WindowInteropHelper and sets that as the dialog's parent, and then manually disables and re-enables the MFC window before and after calling DoModal, but it's an ugly hack.
Has anybody else encountered this type of hosted WPF problem before?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论