views:

1825

answers:

3

I need to put an image in the default view of a custom control. However, whenever I try to test the control it can't locate the image. I have tried to compile it as an embedded resource and just a plain resource in VS. Neither of these have worked. So is there a correct way to do this?

+2  A: 

Look at this post: How can I get a BitmapImage from a Resource?

Sergey Aldoukhov
+1  A: 
Drew Noakes
+1  A: 

That's probably because you specified the image path as a relative path. You should use the Pack URI Scheme to specify that the resource is in the current assembly. For instance :

<Image Source="pack://application:,,,/Images/MyImage.png"/>
Thomas Levesque