In my WPF application, my loaded PNG logo in image shows at design time but not at run time

When you specify the image URI in XAML, it is usually not necessary to write the full URI. Besides the full Pack URI shown in the other answer, you should also be able to write this:

<Image ... Source="images/ServerMainLogo.png"/>

However, you have to make sure that the image file is located in a folder named images in your Visual Studio project and that its Build Action is set to Resource, as shown in this answer.

Alternatively you could set the Build Action to Content and Copy To
Output Directory
to Copy always or Copy if newer. In this case the image is not embedded as resource into your program’s assembly, but simply copied to a directory relative to the executable file.

The (relative) image URI in XAML would work in both cases.

Leave a Comment