Skip to content

Commit

Permalink
Fix a bug when draging a picture
Browse files Browse the repository at this point in the history
  • Loading branch information
fredatgithub committed Mar 10, 2020
1 parent bbbf68b commit 8a768ea
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions FamilyShow/ImageConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,33 @@

namespace Microsoft.FamilyShow
{
public class ImageConverter : IValueConverter
{
#region IValueConverter Members

public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
try
{
BitmapImage bitmap = new BitmapImage(new Uri(value.ToString()));
public class ImageConverter : IValueConverter
{
#region IValueConverter Members

// Use BitmapCacheOption.OnLoad to prevent binding the source holding on to the photo file.
bitmap.CacheOption = BitmapCacheOption.OnLoad;
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
try
{
BitmapImage bitmap = new BitmapImage(new Uri(value.ToString()));

return bitmap;
}
catch
{
return "";
}
}
// Use BitmapCacheOption.OnLoad to prevent binding the source holding on to the photo file.
bitmap.CacheOption = BitmapCacheOption.OnLoad;

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException(Properties.Resources.NotImplemented);
}
return bitmap;
}
catch
{
return string.Empty;
}
}

#endregion
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
//throw new NotImplementedException(Properties.Resources.NotImplemented);
return new object();
}

#endregion
}
}

0 comments on commit 8a768ea

Please sign in to comment.