Tag Archives: Image

Set Source on Image from code in Silverlight

31 Dec

One of the questions that I get a lot and often answers on forums is how to set the Source property on an Image from code.

In XAML it’s really straightforward – you simply set the Source to a string value.

2010-12-31_123947

What’s actually going on is an implicit conversion of the string to and ImageSource.

2010-12-31_125637

From code you can use the ImageSourceConverter as well; or you can use a BitmapImage and an Uri (the way I often do it).

2010-12-31_124043

by xamlgeek
@thomasmartinsen