WPF showing dialog before main window

后端 未结 6 660
无人共我
无人共我 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:06

    Okay apologizes, here is the solution:

    My original question worked almost, only one thing to add, remove the StartupUri from the Application XAML and after that add the Show to main window.

    That is:

    
    

    Above, StartupUri removed.

    Add myMainWindow.Show() too:

    public partial class App : Application
    {
    
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            Window1 myMainWindow = new Window1();
            DialogWindow myDialogWindow = new DialogWindow();
            myDialogWindow.ShowDialog();
            myMainWindow.Show();
        }
    
    }
    

提交回复
热议问题