TextAlignToCheckedConverter.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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;
  8. using System.Windows.Data;
  9. namespace PDF_Master.DataConvert
  10. {
  11. public class TextAlignToCheckedConverter : IValueConverter
  12. {
  13. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  14. {
  15. if (value is string)
  16. {
  17. if (parameter is string)
  18. {
  19. var args = (string)value;
  20. if ((string)parameter == "AlignLeft" && args == "Left")
  21. {
  22. return true;
  23. }
  24. if ((string)parameter == "AlignCenter" && args == "Center")
  25. {
  26. return true;
  27. }
  28. if ((string)parameter == "AlignRight" && args == "Right")
  29. {
  30. return true;
  31. }
  32. if ((string)parameter == "Justify" && args == "Justify")
  33. {
  34. return true;
  35. }
  36. }
  37. }
  38. return false;
  39. }
  40. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  41. {
  42. throw new NotImplementedException();
  43. }
  44. }
  45. }