Last active
August 30, 2019 00:55
-
-
Save dalian-spacekey/20bf5968827bee939ffa4565f8014b3d to your computer and use it in GitHub Desktop.
ByteArrayToImageSourceConverter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ByteArrayToImageSourceConverter : IValueConverter | |
{ | |
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => | |
value == null ? | |
null : | |
ImageSource.FromStream(() => new MemoryStream((byte[])value)); | |
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |
{ | |
throw new NotImplementedException(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Image Source="{Binding Image, Converter={StaticResource ByteArrayToImageSourceConverter}}"/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment