I am currently writing a WPF application which does command-line argument handling in App.xaml.cs (which is necessary because the Startup event seems to be the recommended w
First remove the StartupUri property from App.xaml and then use the following:
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); bool doShutDown = ...; if (doShutDown) { Shutdown(1); return; } else { this.StartupUri = new Uri("Window1.xaml", UriKind.Relative); } }