WPF Image Rendering on Headers

By Charlotte

I’ve been having a little bit of trouble lately with WPF, in particular the rendering of an image on the header of the TabItem or GroupBox headers (for example), I have the following code:


<GroupBox>
<GroupBox.Header>
<Image Source=”./Images/MyImage.png”/>
</GroupBox.Header>
</GroupBox>

Which renders fine in Visual Studio, but the minute I run the app – F5ing – The image isn’t displayed.

It took me a while to figure out – even though the image is in the right location, it’s not actually part of the solution, i.e. I hadn’t added it to the Images folder of the solution. When added there (so it was visible in the solution explorer), happy days!