Bool2Not.cs 712 B

123456789101112131415161718192021222324252627
  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. }