Reputation: 36563
I feel like I've solved this problem 10 times before but I can never remember how exactly to do it, since someone decided to make pack uris in xaml complete rocket science..
I have an image marked as a resource. I have a xaml UserControl in a class library (a dll) that needs to reference this image in markup. I have this UserControl and image in two dlls - a Silverlight version and a WPF version.
The image is in the same directory as the UserControl in both versions. It's marked as "Resource"
I have a Silverlight app that references the Silverlight dll and a WPF app that references the WPF dll.
How can I make my xaml reference the image with an assembly local relative URI, keeping in mind the following:
I've tried using
./MyImage.png
MyImage.png
/MyImage.png (which I know shouldn't work)
Upvotes: 0
Views: 397
Reputation: 31724
Just "MyImage.png" should work if both it and the control are in project root folder. If both are under Controls - you would need "Controls/MyImage.png". The path isn't relative to control location - it is relative to project root folder.
Upvotes: 0