In my assembly project I have a .png image which it's Build Action is set to Resource.
Now I want to make the following:
_myIcon = new BitmapImage(new Uri(**path to the image embedded on the assembly**));
I have looked into the examples in http://msdn.microsoft.com/en-us/library/aa970069(v=vs.110).aspx but as far as I tried gives me "Invalid URI: The format of the URI could not be determined.". I don't think this should be a complicated matter, am I taking the wrong approach?
The other answer is valid but doesn't produce a BitmapSource.
The correct answer, given that I have a folder called Images and inside an Image with the Build Action set to Resource, is to use a Resource File Pack URI:
_myIcon = new BitmapImage(new Uri("pack://application:,,,/Images/MyImage.png");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With