Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I have a problem which should be so easy to solve, but apparently it isn't for a former winform developer like me ;-)

So, does anyone have a working sample using Images referenced in a merged ResourceDictionary?
Images must be embedded into my dll/application.

I tried almost all "solutions" found on the internet, but without any luck.

In my resourceDictionary I have(among others) the following entry:
HTML
<BitmapImage x:Key="ImageMedal" UriSource="/MyDll;component/Properties/Images/award_star_gold_1.png" />

Nb. I tried building the Image as both Resource and embedded resource, but it doesn't change anything.

My xaml declaration is as the follows:
HTML
...
<!--This  works, and shows the Image correctly: -->
<Image Source="/MyDll;component/Properties/Images/award_star_gold_1.png"></Image>

<!--This does NOT work (no error, but the image is just empty) -->
<Image Source="{DynamicResource ImageMedal}"></Image>
...

It does show both images correctly in the designer, but only one of them when deployed.

Nb. I did not export the Image file to the deploy directory; and I don't want to.

The Dictionary is loaded correctly since a lot of other stuff from my merged dictionay works fine.

What am I doing wrong?
Posted
Updated 31-Oct-13 21:32pm
v13
Comments
Kenneth Haugland 1-Nov-13 3:29am    
What exacly is your problem?

1 solution

<bitmapimage x:key="MyDocImage" createoptions="IgnoreImageCache" cacheoption="OnLoad" urisource="pack://application:,,,/DC.Pdb.Plugin.Plugin;component/Properties<br />
/Images/document_editing.png" xmlns:x="#unknown" />
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900