【发布时间】:2017-06-23 11:32:12
【问题描述】:
我有一个WPF MainWindow,我可以在其中打开第二个,如下所示,以this post为例:
var win = new CalibrationWindow(){Owner = this};
win.ShowDialog();
我很少遇到以下运行时异常“cannot set owner property to a window that has not been shown previously”。
你有什么建议吗?提前致谢。
【问题讨论】:
-
这可能表明
this- 您的主窗口 - 尚未显示。 -
不,显示主窗口是因为我在按下按钮后才打开第二个窗口。