How to create a bitmap image programmatically when its source is an image with Build Action = Resource?
When I try the following I get an invalid URI exception 🙁
BitmapImage image = new BitmapImage(new Uri("/MyAssembly;component/Images/MyImage.png"));
I’m using silverlight 4 and this code is inside one of the many projects of my solution (it’s a silverlight class library and not the silverlight application).
should be:
Images/MyImage.pngalso assumes your image is located inside a folder calledImages.