|
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Text;
- using System.Windows.Data;
- using System.Windows.Media;
-
- namespace Converter
- {
- public class TextForegroundConvert : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value != null)
- {
- if (value.ToString() == "正常")
- return Brushes.White;
- else if (value.ToString() == "异常")
- return Brushes.Yellow;
- else if (value.ToString() == "未连接")
- return Brushes.Yellow;
- }
- return default;
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|