PropertyPanelVisible.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using ComPDFKitViewer.AnnotEvent;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Globalization;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Data;
  10. using System.Windows.Media;
  11. namespace PDF_Office.DataConvert
  12. {
  13. public class PropertyPanelVisible : IValueConverter
  14. {
  15. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  16. {
  17. if(value is string)
  18. {
  19. var panelType = (string)value;
  20. if(parameter.ToString() == panelType)
  21. switch(panelType)
  22. {
  23. case "HighLight":
  24. return Visibility.Visible;
  25. default:
  26. break;
  27. }
  28. }
  29. return Visibility.Collapsed;
  30. }
  31. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  32. {
  33. throw new NotImplementedException();
  34. }
  35. }
  36. public class CheckToVisibleMutiConvert : IMultiValueConverter
  37. {
  38. public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  39. {
  40. for (int i = 0; i < values.Length; i++)
  41. {
  42. if ((bool)values[i] == true)
  43. return Visibility.Collapsed;
  44. }
  45. return Visibility.Visible;
  46. }
  47. public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
  48. {
  49. throw new NotImplementedException();
  50. }
  51. }
  52. public class ColorToBrushConverter : IValueConverter
  53. {
  54. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  55. {
  56. if (value is Color)
  57. {
  58. return new SolidColorBrush((Color)value);
  59. }
  60. return Brushes.Transparent;
  61. }
  62. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  63. {
  64. throw new NotImplementedException();
  65. }
  66. }
  67. }