ReverseBoolConverter.cs 762 B

12345678910111213141516171819202122232425262728293031
  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;
  8. using System.Globalization;
  9. namespace Compdfkit_Tools.Common
  10. {
  11. [ValueConversion(typeof(bool), typeof(bool))]
  12. public class ReverseBoolConverter:IValueConverter
  13. {
  14. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  15. {
  16. if ((bool)value == true)
  17. {
  18. return false;
  19. }
  20. else
  21. return true;
  22. }
  23. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  24. {
  25. return null;
  26. }
  27. }
  28. }