Set the source for an image from C#

Posted by Corey on March 16, 2008 at 11:24 pm.

In Silverlight, there are two ways to set the source for an image.

  1. image.SetValue(Image.SourceProperty,value);
  2. image.Source = new BitmapImage(new Uri(value, UriKind.Absolute));

For the second option you will need to include the following namespace: using System.Windows.Media.Imaging;.

Leave a Reply