12345678910111213141516171819202122 |
- using System;
- using System.Globalization;
- using System.IO;
- using Xamarin.Forms;
- namespace InABox.Mobile
- {
- public class ByteArrayToImageSourceConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value is byte[] bytes)
- return ImageSource.FromStream(() => new MemoryStream(bytes));
- return ImageSource.FromFile("cross");
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|