Popup a window before the MainWindow
protected override void OnStartup(StartupEventArgs e)
{
Window w = new Window();
w.ShowDialog();
base.OnStartup(e);
}
当w窗口关闭的时候会结束整个进程。
The reference to the first Window object to be instantiated is also added as the first item to the Windows collection. If MainWindow is subsequently set with a reference to a different Window, the position of the item with the reference to the main window will change, while the order of items in Windows remains the same. Consequently, always use MainWindow to refer to the main window instead of the first item in Windows.
源码:

解决方案:


浙公网安备 33010602011771号