BoolToColor.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 BoolToColor : 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.Gray)) : new SolidColorBrush(Colors.Gray);
  15. }
  16. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  17. {
  18. return null;
  19. }
  20. }
  21. public class BoolToColor8 : IValueConverter
  22. {
  23. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  24. {
  25. return value != null ? ((bool)value ? new SolidColorBrush(Colors.Transparent) : new SolidColorBrush(Colors.Gray)) : new SolidColorBrush(Colors.Transparent);
  26. }
  27. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  28. {
  29. return null;
  30. }
  31. }
  32. }