Saturday, May 01, 2010

Hello World – Windows Phone 7

image

Loading an image in SilverLight at run-time.

Drag an image control onto the design surface. Call it SampleImage.

if (Uri.IsWellFormedUriString(UrlTextBox.Text, UriKind.RelativeOrAbsolute))
{
BitmapImage bi = new BitmapImage();
bi.UriSource = new Uri(UrlTextBox.Text, UriKind.RelativeOrAbsolute);
SampleImage.Source = bi;
}

And here is a sample URL that you can use: http://bit.ly/dp9R26 (links to the Windows phone image shown above).

No comments: