Search code examples
c#wpfxamlvisual-studio-2010splash-screen

Change duration of splash screen?


I recently added a splash screen to my WPF app.My app loads fast so the screen is only on for milliseconds.How would i lengthen the time my splash screen stays up.I would like it to be two seconds.


Solution

  • If you trigger the splash screen to show in the Application.Startup Event you will have full control over it. (be sure to call .Show() with false)

    private void Application_Startup(object sender, StartupEventArgs e)
    {
       SplashScreen screen = new SplashScreen("splashScreen.png");
       screen.Show(false);
    }
    

    Then you can call screen.Close() when you would like the splash screen to close.