BooleanToBrush.cs 673 B

123456789101112131415161718192021222324
  1. using System;
  2. using System.Globalization;
  3. using System.Windows.Data;
  4. using System.Windows.Media;
  5. namespace LogoForceTestApp.Modules.MainModule.Converters
  6. {
  7. internal class BooleanToBrush : IValueConverter
  8. {
  9. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  10. {
  11. if (value is bool ret)
  12. {
  13. return ret ? Brushes.Green : Brushes.Red;
  14. }
  15. return Brushes.Red;
  16. }
  17. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  18. {
  19. throw new NotImplementedException();
  20. }
  21. }
  22. }