WPF showing dialog before main window

后端 未结 6 666
无人共我
无人共我 2020-12-03 02:49

How one can show dialog window (e.g. login / options etc.) before the main window?

Here is what I tried (it apparently has once worked, but not anymore):

6条回答
  •  半阙折子戏
    2020-12-03 03:17

    So you want to show one window, then another, but close down the app when that window is closed? You may need to set the ShutdownMode to OnMainWindowClose and set the MainWindow to Window1, along the lines ok:

    Window1 myMainWindow = new Window1();
    Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;
    Application.Current.MainWindow = myMainWindow;
    DialogWindow myDialogWindow = new DialogWindow();
    myDialogWindow.ShowDialog();
    

提交回复
热议问题