Skip to content

Instantly share code, notes, and snippets.

@RobGibbens
Created July 27, 2013 15:12
Show Gist options
  • Select an option

  • Save RobGibbens/6095120 to your computer and use it in GitHub Desktop.

Select an option

Save RobGibbens/6095120 to your computer and use it in GitHub Desktop.

Revisions

  1. RobGibbens created this gist Jul 27, 2013.
    23 changes: 23 additions & 0 deletions BitmapImageValueConverter.cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    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;
    }
    }