Bool2Not.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using System.Windows.Data;
  3. namespace Venus_Themes.Converters
  4. {
  5. public class Bool2Not : IValueConverter
  6. {
  7. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  8. {
  9. if (value == null) return false;
  10. if (!(value is bool))
  11. return false;
  12. return !(bool)value;
  13. }
  14. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  15. {
  16. if (value == null) return false;
  17. if (!(value is bool))
  18. return false;
  19. return !(bool)value;
  20. }
  21. }
  22. public class Bool2Easy : IValueConverter
  23. {
  24. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  25. {
  26. if (value == null) return false;
  27. if (!(value is bool))
  28. return false;
  29. return (bool)value;
  30. }
  31. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  32. {
  33. if (value == null) return false;
  34. if (!(value is bool))
  35. return false;
  36. return (bool)value;
  37. }
  38. }
  39. }