0
private void AppToStart(object sender, StartupEventArgs e)
{           
    var startUpWindow=new StartUpWindow();
    startUpWindow.ShowDialog();
    var mainWindow = new MainWindow();
    mainWindow.ShowDialog();
}

I have wrote these commands to ShowDialog MainWindow after StartUpWindow. But when I close the StartUpWindow instance, the entire application closes. What's wrong with my code? If there is a better way to doing what I want instead of creating an instance and calling his ShowDialog method please tell me.

Michael Hancock
  • 2,673
  • 1
  • 18
  • 37
DiniMad
  • 49
  • 1
  • 9

2 Answers2

0

You could start by checking your Application.ShutdownMode property to see what it is set to. It can be found in App.xaml.

Per MSDN:

A ShutdownMode of OnMainWindowClose causes Windows Presentation Foundation (WPF) to implicitly call Shutdown when the MainWindow closes, even if other windows are currently open.

BlueTriangles
  • 1,124
  • 2
  • 13
  • 26
0

after i added ShutdownMode="OnExplicitShutdown" in APP.xaml properties , my app closing with Application.Current.Shutdown(); method.

DiniMad
  • 49
  • 1
  • 9