123456789101112131415161718192021222324252627 |
- using System;
- using System.Globalization;
- using System.Windows.Data;
- using System.Windows.Media;
- namespace Aitex.Sorter.UI.Converter
- {
- public class LedConverter : IMultiValueConverter
- {
- static Brush GreenBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF07FF07"));
- static Brush GrayBrush = new SolidColorBrush(Colors.LightGray);
- static Brush RedBrush = new SolidColorBrush(Colors.Red);
- public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
- {
- var value = (bool)values[0];
- var red = (bool)values[1];
- return value ? red ? RedBrush : GreenBrush : GrayBrush;
- }
- public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|