How to Add a Splash Screen to a WPF App
In this article
To add a splash screen to a WPF application, use the built-in SplashScreen build action: add a PNG or BMP image to your project, set its Build Action to SplashScreen in the Properties window, and WPF will display it automatically before the main window loads. This works in .NET Framework and modern .NET WPF projects without any extra NuGet packages or code. The steps below cover that method, plus how to control it manually if you need more than the default behavior.
What You'll Need
- Visual Studio with a WPF project (any recent version; menu labels can differ slightly by version and edition).
- A splash image file in PNG or BMP format. WPF's automatic splash screen supports these formats; JPG is not supported by the built-in SplashScreen build action.
- The image should be sized to the resolution you want it displayed at. The default splash screen shows the image at its native pixel size, centered on screen, with no scaling.
Step-by-Step
- Open your WPF project in Visual Studio and locate the image file in Solution Explorer. If it is not there yet, right-click the project in Solution Explorer, choose Add > Existing Item, and select your PNG or BMP file.
- Select the image in Solution Explorer. In the Properties window (press F4 if it is not visible), find the Build Action property.
- Change Build Action from Resource (or whatever it currently is) to SplashScreen. This is the key step: the SplashScreen build action tells WPF to show the image automatically at startup, before the Application object finishes initializing.
- Build and run the application (F5). You should see the splash image appear briefly while the main window loads. On a fast machine with a simple app, it may flash by so quickly you barely notice it.
- If you want to confirm it is working, add a short delay in your startup logic temporarily (for example, a
Thread.Sleep(2000)in the main window constructor or in anApplication_Startuphandler) and run again. Remove the delay afterward. - To control the splash screen manually instead of relying on the automatic behavior, remove the SplashScreen build action (set it back to Resource) and add code in
App.xaml.csinside theOnStartupoverride: create aSplashScreenobject with the pack URI of the image, callShow(true), do your initialization work, then callClose()on the splash screen before showing the main window. TheSplashScreenclass lives in theSystem.Windowsnamespace. - If you need a splash screen with animation, progress text, or a custom layout, the built-in image approach is not enough. Create a normal WPF
Windowwith no border andShowInTaskbar="False", show it fromOnStartupbefore your main window, run your initialization, then close it and show the main window. This gives you full XAML control but requires you to manage the timing yourself.
Common Mistakes
- Using a JPG. The SplashScreen build action only supports PNG and BMP. A JPG set to SplashScreen will either fail to build or not display. Convert it to PNG first.
- Leaving Build Action as Resource. This is the most common cause of "my splash screen does not show." The image is in the project but WPF is not told to treat it as a splash screen.
- Expecting the splash to stay visible for a fixed time. The automatic splash screen closes as soon as the main window is ready. On fast machines it can disappear in under a second. If you need a minimum display time, use the manual
SplashScreenclass approach and control when you callClose(). - Assuming the image will scale. The built-in splash screen displays the image at its native size. If the image is 200x200 pixels, it appears as a small 200x200 image in the center of the screen. Design the image at the size you want it shown.
- Adding the splash image to a folder and losing the pack URI. If you use the manual approach, the URI must match the file's path in the project, for example
pack://application:,,,/Images/splash.png. A wrong path throws an exception or shows nothing.
Tips
- Keep the splash image simple and lightweight. A large, high-resolution image adds to startup time because it must be decoded before it is shown.
- Use a transparent PNG if you want the splash to blend with the desktop background; the built-in splash screen supports transparency in PNG files.
- If your app does heavy work in the main window constructor, the splash screen will stay visible longer naturally. If you want to guarantee a minimum display time, do the manual approach and close the splash only after your initialization completes or after a timer elapses.
- Test on a slower machine or in a Release build; Debug builds often start more slowly, which can make the splash screen seem more prominent than it will be for users.
- For a branded look, match the splash image's background color to your app's theme so the transition to the main window feels seamless.
Troubleshooting
If the splash screen does not appear at all, first confirm the image's Build Action is set to SplashScreen and not Resource or Content. Rebuild the solution (Build > Rebuild Solution) rather than just running, since build action changes sometimes require a clean build to take effect. If you are using the manual SplashScreen class, check that the pack URI is correct and that the image's Build Action is Resource (not SplashScreen) in that case, because the automatic behavior and manual behavior are alternatives, not complements. If the splash appears but is the wrong size, remember it is shown at native pixel size; resize the source image. If the splash appears and then the app crashes before the main window shows, the problem is in your startup code, not the splash screen; check the exception details in the Output window or debugger. If you see the splash only in Debug but not Release, check that the image file is included in the Release build and that no conditional compilation excludes it.
Frequently Asked Questions
Does the WPF splash screen support animated GIFs?
No. The built-in SplashScreen build action supports static PNG and BMP images only. For animation, use a custom Window with a XAML animation and show it manually at startup.
Can I set how long the splash screen stays visible?
Not with the automatic build action; it closes as soon as the main window is ready. Use the manual SplashScreen class in OnStartup and call Close() when you choose, optionally after a timer or after initialization finishes.
Why does my splash screen show as a tiny image in the center?
The built-in splash screen displays the image at its native pixel dimensions with no scaling. Create the image at the size you want it displayed on screen.
Does this work in .NET 6, .NET 7, or .NET 8 WPF projects?
Yes. The SplashScreen build action and the System.Windows.SplashScreen class are part of WPF and work the same way in modern .NET WPF projects as in .NET Framework, as long as the project uses the WPF SDK and references PresentationFramework.
Can I have more than one splash screen image?
Only one image can be set to the SplashScreen build action per project. If you need different splash screens for different scenarios, use the manual SplashScreen class and choose the image path at runtime.
What image formats are supported?
PNG and BMP. JPG, GIF, and other formats are not supported by the SplashScreen build action. Convert your image to PNG if needed.