Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF Splash Screen Adding Fails

I need to put up a png image as splash screen for my WPF.

I imported the file to project and changed Build Action to 'Splash Screen'

This should have done the job, but I am getting this error message:

Unknown build error, 'An item with the same key has already been added.'

Googling the error didn't help.

like image 699
Pranjal Avatar asked Mar 26 '13 16:03

Pranjal


People also ask

How to add splash screen to WPF application in Visual Studio?

Follow this steps for adding splash screen into WPF application in Visual Studio: Create or get any image and add it to your project (e.g. inside Images folder): Open properties window for this image (View → Properties Window) and change Build Action setting to SplashScreen value: Run the application.

How do I add a splash screen to my application?

In the Properties window, click the drop-down arrow for the Build Action property. Select SplashScreen from the drop-down list. Press F5 to build and run the application. The splash screen image appears in the center of the screen, and then fades when the main application window appears. In Solution Explorer, select the splash screen image.

How do I get the splash screen to appear and disappear?

Run the application. You'll see your splash screen image on the center of the screen before application window appears (after window appears, splash screen image will faded out within about 300 milliseconds). If your application is lightweight and simple, it will launch very fast, and with similar speed will appear and disappear splash screen.

How do I add an image to a WPF application?

You can use any image format that is supported by the Windows Imaging Component (WIC). For example, you can use the BMP, GIF, JPEG, PNG, or TIFF format. Add the image file to the WPF Application project. In Solution Explorer, select the image. In the Properties window, click the drop-down arrow for the Build Action property.


1 Answers

I can confirm that changing the build action to Application Definition and then building (there will be errors), then switching it back to Splash Screen and running the program clears this error.

like image 102
jporcenaluk Avatar answered Oct 23 '22 16:10

jporcenaluk