26 lines
786 B
C#
26 lines
786 B
C#
using System;
|
|
using System.Globalization;
|
|
using Avalonia.Data.Converters;
|
|
using Avalonia.Media;
|
|
|
|
namespace ChronoFlow.View.Converter
|
|
{
|
|
public class BoolToBrushConverter : IValueConverter
|
|
{
|
|
public IBrush TrueBrush { get; set; } = Brushes.Blue;
|
|
public IBrush FalseBrush { get; set; } = Brushes.Gray;
|
|
|
|
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
if (value is bool boolValue && boolValue)
|
|
return Brushes.Blue;
|
|
|
|
return Brushes.Gray;
|
|
}
|
|
|
|
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException(); // wird i.d.R. nicht benötigt
|
|
}
|
|
}
|
|
} |