Skip to content

Instantly share code, notes, and snippets.

@RobGibbens
Created July 27, 2013 15:12
Show Gist options
  • Save RobGibbens/6095120 to your computer and use it in GitHub Desktop.
Save RobGibbens/6095120 to your computer and use it in GitHub Desktop.
MvvmCross BitmapImageValueConverter
public class BitmapImageValueConverter : MvxValueConverter<byte[], BitmapImage>
{
protected override BitmapImage Convert(byte[] value, Type targetType, object parameter, CultureInfo culture)
{
var bitmapImage = new BitmapImage();
try
{
if (value != null)
{
var ms = new MemoryStream(value);
bitmapImage.SetSource(ms);
}
}
catch (Exception exception)
{
#if DEBUG
throw;
#endif
}
return bitmapImage;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment