views:

9

answers:

1

I have a Silverlight Business Application project. I also added a Silverlight Class Library to be used from my Silverllight app (of course).

Inside that library (let's call it helper) I have a folder and some small images. In that same library I have a child window with a Image control which I need to change the source info at runtime (code behind).

I found some code online that should work, as a matter of facts it does, when I add an internet uri, say to a flickr image. So my problem is that I'm not writing the Uri right :(

Uri uri = new Uri("MyProj.Silverlight.Helper;images/error.png",UriKind.Relative);
ImageSource img = new System.Windows.Media.Imaging.BitmapImage(uri);
dlg.image.Source = img;

I feel I've already tried every possible way, obviously I havn't :(

Edit: I found a pretty cool post about it, but still no luck. Has it changed since Silverlight 2?

+1  A: 

Use the format: "/MyProj.Silverlight.Helper;component/images/error.png"

The / at the beginning and the keyword component are very important!

Ref: http://msdn.microsoft.com/en-us/library/aa970069.aspx

Rob Fonseca-Ensor