How to set uri for local image in silverlight app?

Posted by KentZhou on Stack Overflow See other posts from Stack Overflow or by KentZhou
Published on 2010-03-22T19:44:16Z Indexed on 2010/03/22 21:01 UTC
Read the original article Hit count: 321

Filed under:
|

In SL class library MyLib, I have a image say my.png. Then I want to use it in code behind I tried following way:

StreamResourceInfo resourceStream = Application.GetResourceStream(new Uri("/MyLib;component/my.png", UriKind.Relative));    
BitmapImage image = new BitmapImage();                                
image.SetSource(resourceStream.Stream);
this.MyIcon.Source = image;   

But it's not woking. I think it's the Uri not set correctly. Help please.

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about image