BoolToBrushConvert.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows.Data;
  8. using System.Windows.Media;
  9. namespace PDF_Office.DataConvert
  10. {
  11. internal class BoolToBrushConvert : IValueConverter
  12. {
  13. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  14. {
  15. if (value is bool flag)
  16. {
  17. if (flag)
  18. {
  19. //Color color = (Color)App.Current.FindResource("color.sys.text.accent.norm");
  20. return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#1770F4"));
  21. //return new SolidColorBrush(color);
  22. }
  23. }
  24. return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#616469"));
  25. }
  26. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  27. {
  28. return null;
  29. }
  30. }
  31. }