public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
{
return DependencyProperty.UnsetValue;
}
BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.CacheOption = BitmapCacheOption.OnLoad;
RenderOptions.SetBitmapScalingMode(bi, BitmapScalingMode.HighQuality);
bi.UriSource = new Uri(value.ToString());
bi.EndInit();
return bi;
}