BoolToGreenRedColor.cs 771 B

1234567891011121314151617181920212223242526
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows.Data;
  7. using System.Windows.Media;
  8. namespace CyberX8_Themes.Converters
  9. {
  10. public class BoolToGreenRedColor : IValueConverter
  11. {
  12. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  13. {
  14. return value!=null? ((bool)value ? new SolidColorBrush(Colors.Lime) : new SolidColorBrush(Colors.Red)) : new SolidColorBrush(Colors.Red);
  15. }
  16. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  17. {
  18. return null;
  19. }
  20. }
  21. }