silverlightsilverlight-2.0

Silverlight image: load URL dynamically?


I'm tinkering with Silverlight 2.0.

I have some images, which I currently have a static URL for the image source. Is there a way to dynamically load the image from a URL path for the site that is hosting the control?

Alternatively, a configuration setting, stored in a single place, that holds the base path for the URL, so that each image only holds the filename?


Solution

  • In the code behind or a value converter you can do

      Uri uri = new Uri("http://testsvr.com/hello.jpg");
      YourImage.Source = new BitmapImage(uri);