c#: System.Windows.Application.Current.MainWindow在其他PC上没有返回相

本文关键字:PC 返回 其他 System Windows Application MainWindow Current | 更新日期: 2023-09-27 17:53:30

在Visual Studio 2010中,我使用WPF构建了一个Mdi应用程序。当调用弹出窗口时,我想设置当前主窗口的所有者。因此,我们使用System.Windows.Application.Current.MainWindow属性来设置Owner。

这在我所有同事的电脑上都有效,但在我的电脑上不行。它总是返回弹出窗口本身。为什么? ?

c#: System.Windows.Application.Current.MainWindow在其他PC上没有返回相

您需要访问这个窗口,因此尝试使用window。从System.Windows.Window.

获取窗口方法