Change Startup Window
To change startup window update App.xaml
by changing Application.StartupUri
:
<Application ... StartupUri="MainWindow.xaml">
To change the startup window programmatically go to App.xaml
remove the line StartupUri="MainWindow.xaml"
(This will remove the default startup window configuration), now add the startup event Startup="Application_Startup"
, in App.xaml.cs
private void Application_Startup(object sender, StartupEventArgs e){ If(somecase) { MainWindow mainWindow = new MainWindow (); mainWindow.Show(); } else { OtherWindow otherWindow= new OtherWindow(); otherWindow.Show(); }}