Image in WPF Button not Visible at Runtime

Change the build action to 'Resource'. Also your pack url is wrong. Either use:

Source="pack://application:,,,/Resource/UserCost2013Open16.png"

or simply

Source="/Resource/UserCost2013Open16.png"

There are 2 Solutions:

1: Change the settings of the image:

Build Action = Content
Copy to output directory = Copy if newer
Source="pack://siteoforigin:,,,/Resources/UserCost2013Open16.png"


2: When Using application instead of siteoforigin in the source path, you have to possible ways:

a) Image will be in a SubFolder called "Resources" and .exe file will be small

Source="pack://application:,,,/Resources/UserCost2013Open16.png"
Build Action = Content
Copy to output directory = Copy if newer

b) Image will be included in the .exe and no Subfolder with imagefile will exist

Source="pack://application:,,,/Resources/UserCost2013Open16.png"
Build Action = Resource
Copy to output directory = Copy if newer

Assumeing that you have

  • set your Build Action to Resource

  • set that path correctly using URI-PACK-FORMAT

In my case it was still not showing.

Clean & Rebuild NOT just Build fixed it for me !


In my case I had the images in a separate project named Common and the images were under a folder named Resources in this project. In my other project, I added a reference to Common and set the source of the images like this:

<Image Source="/Common;component/Resources/anImage.png"/>

The images have the Build Action set to Resource and Copy to Output Directory to Do not copy. However, for some strange reason it wasn't working until I deleted every assembly file in my solution and made a Clean Solution and Build Solution. Not sure why, but it all started working at runtime once I rebuilt everything. I still can't figure out why it was working at Design Time though.


Go to your image in the resources folder, right click on the image, go to properties, click on the Build Action property, and change it from None to Resource. That'll work.