123456789101112131415161718192021222324252627 |
- using Avalonia.Data.Converters;
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Avalonia.Media.Imaging;
- using System.IO;
- using Avalonia.Platform;
- namespace AvaloniaApplication4.Converters
- {
- internal class ImageConverter : IValueConverter
- {
- public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
- {
- return value == null ? new Bitmap(AssetLoader.Open(new Uri("avares://AvaloniaApplication4/Assets/picture.png"))) : new Bitmap(new MemoryStream((byte[])value));
- }
- public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|