In Silverlight 1.1, it was impossible to load images from the local file system unless you uploaded them to a server first. In Silverlight 2.0, it’s a piece of cake to load local images as long as you involve the user by displaying an OpenFileDialog:

OpenFileDialog ofd = new OpenFileDialog();

ofd.Filter = “JPEG Files (*.jpg;*.jpeg)|*.jpg;*.jpeg | All Files (*.*)|*.*”;

ofd.FilterIndex = 1;

if (ofd.ShowDialog() == DialogResult.OK)


    Stream stream = ofd.SelectedFile.OpenRead();

    BitmapImage bi = new BitmapImage();


    MyImage.Source = bi;



In this example, “MyImage” is a reference to a XAML Image object.

I just returned from DevWeek in London. The excitement level around Silverlight was very high, and the highlight of my week was doing Silverlight presentations for standing-room-only crowds. Thanks to Dave Wheeler for talking up Silverlight in his keynote and getting the crowds thinking about XAML!