laatzen/Common/Ui/Common.UI/Infrastructure/BooleanToBackgroundConverter.cs
2024-12-03 17:03:33 +01:00

35 lines
965 B
C#

namespace Common.UI.Infrastructure
{
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
public class BooleanToBackgroundConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var converter = new BrushConverter();
if (value is bool success)
{
if (!success)
{
return converter.ConvertFrom("#88FCBA03");
}
else
{
return converter.ConvertFrom("#8890EE90");
}
}
else
{
return Brushes.WhiteSmoke;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
=> throw new NotImplementedException();
}
}