BoolToColor.cs 843 B

123456789101112131415161718192021222324252627
  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 Venus_Themes.Converters
  9. {
  10. public class BoolToColor : IValueConverter
  11. {
  12. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  13. {
  14. if (value == null) return new SolidColorBrush(Colors.Gray);
  15. return (bool)value ? new SolidColorBrush((Color)ColorConverter.ConvertFromString("#07B699")) : new SolidColorBrush(Colors.Gray);
  16. }
  17. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  18. {
  19. if (value == null) return false;
  20. return null;
  21. }
  22. }
  23. }