首页 > 技术文章 > 【WPF】Winform调用WPF窗体注意事项

mqxs 2016-08-29 16:50 原文

 1、需要添加一些引用

2、调用处使用如下方法进行调用

Window win= new Window();   
ElementHost.EnableModelessKeyboardInterop(win);
WindowInteropHelper winHelper = new WindowInteropHelper(win);
winHelper.Owner = this.Handle;
win.Show();

 没有ElementHost.EnableModelessKeyboardInterop(wpfwindow)WPF快捷键无效。

WindowInteropHelper类作用是为WPF设置owner。

 

推荐阅读