Files
DP44/Common/DTS.CommonCore/.svn/pristine/a5/a59f64b204846cc2c927cc30d2238ae8075acb82.svn-base

30 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
using System;
using System.Windows.Data;
using System.Windows.Media;
namespace DTS.Common.Converters
{
public class BooleanToColorConverter : IValueConverter
{
public bool Background { get; set; } = false;
public bool Inverted { get; set; } = false;
public bool AttentionBrush { get; set; } = false;
public bool WarningBrush { get; set; } = false;
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
value = Inverted ? !(bool) value : value;
if ((bool)value)
{
return Background ? Brushes.Transparent : BrushesAndColors.Brush_NoError;
}
return AttentionBrush ? BrushesAndColors.Brush_Attention : WarningBrush ? BrushesAndColors.Brush_Warning : BrushesAndColors.Brush_Error;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return null;
}
}
}