IntToColorBrush.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. class IntToColorBrush : IValueConverter
  12. {
  13. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  14. {
  15. SolidColorBrush brush = new SolidColorBrush(Colors.Black);
  16. switch ((int)value)
  17. {
  18. case 1:
  19. brush = new SolidColorBrush(Color.FromArgb(0xFF, 0x25, 0x26, 0x29));
  20. break;
  21. case 2:
  22. brush = new SolidColorBrush(Color.FromArgb(0xFF, 0xF3, 0x46, 0x5B));
  23. break;
  24. case 3:
  25. brush = new SolidColorBrush(Color.FromArgb(0xFF, 0x27, 0x3C, 0x62));
  26. break;
  27. case 4:
  28. brush = new SolidColorBrush(Color.FromArgb(0xFF, 0x94, 0x98, 0x9C));
  29. break;
  30. default:
  31. break;
  32. }
  33. return brush;
  34. }
  35. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  36. {
  37. throw new NotImplementedException();
  38. }
  39. }
  40. }