Initial Push
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace HMIToolkit
|
||||
{
|
||||
public class BoolToBrushConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (targetType != typeof(Brush))
|
||||
throw new InvalidOperationException("The target must be a brush");
|
||||
|
||||
bool temp = bool.Parse(value.ToString()!);
|
||||
|
||||
return (temp ? Brushes.DarkGreen : Brushes.DarkRed);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return DependencyProperty.UnsetValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user