using System; using System.Globalization; using Avalonia.Data.Converters; using Avalonia.Media; namespace DispenserUI.ViewModels.Converter; public class StatusColorConverter : IValueConverter { public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { if (parameter is null) { return value is true ? Brushes.Green : Brushes.Gray; } var color = (string)parameter; return value is true ? Brush.Parse(color) : Brushes.Gray; } public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) { throw new NotImplementedException(); } }