using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Data; using System.Windows.Media; namespace Aitex.Core.UI.Converters { /// /// 输入数值检测 /// public class ColorConverter_IsTestOK : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null || value.ToString().Length == 0) return new SolidColorBrush(Colors.Gray); if (value.ToString() == "OK") return new SolidColorBrush(Colors.Green); else if (value.ToString() == "NG") return new SolidColorBrush(Colors.MediumVioletRed); else return new SolidColorBrush(Colors.Gray); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return null; } } }