JD2022-TU1/main/tools/apps/ResourceViewer/Converters/BoolToBrushConverter.cs

31 lines
838 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows.Media;
namespace ResourceViewer
{
[ValueConversion(typeof(bool), typeof(Brush))]
public class BoolToBrushConverter : IValueConverter
{
public object Convert(object value, Type targetType,
object parameter, System.Globalization.CultureInfo culture)
{
switch ((bool)value)
{
case false:
return Brushes.LightCoral;
default:
return Brushes.LightGreen;
}
}
public object ConvertBack(object value, Type targetType,
object parameter, System.Globalization.CultureInfo culture)
{
return false;
}
}
}