ImageConverter.cs 746 B

1234567891011121314151617181920212223242526
  1. using Avalonia.Data.Converters;
  2. using Avalonia.Media.Imaging;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Globalization;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace AvaloniaApplication1.Resources
  11. {
  12. internal class ImageConverter : IValueConverter
  13. {
  14. public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
  15. {
  16. if (value is byte[]) return new Bitmap(new MemoryStream((byte[])value));
  17. return null;
  18. }
  19. public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
  20. {
  21. throw new NotImplementedException();
  22. }
  23. }
  24. }