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

One Response to “Set Source on Image from code in Silverlight”

Trackbacks/Pingbacks

  1. MS Visual Studio 2010 » Blog Archive » Подборка ссылок. 31.12.2010 - January 15, 2011

    […] xamlgeek- thoughts from a silverlight mvp : Set Source on Image from code in Silverlight ; […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: