Over the years, I've conditioned myself to use the Uri classwhen surfacing web URLs in my application. Early versions ofSilverlight couldn't bind an image source directly to an instanceof a Uri because they lacked an appropriate type converter; theusual workaround was to change the property to a string type.
Subsequent versions Silverlight added that capability and theconverter. For example. Given an instance of the following modelclass as the data context:
public class Tweet
{
public string Message { get; set; }
public Uri Image { get; set; }
}In Silverlight, you can bind in XAML like this:
<Image Source="{Binding Image}" />
In the current version of Windows 8/WinRT XAML, you can't bindimage sources directly to Uris, but there's a nice way to do it byusing property element syntax and and a BitmapImage class. It'smore verbose, but may be just the ticket if ...
Go to the complete details ...
Found interesting? Add this to: