ObjectToVisibilityConverter.cs 886 B

1234567891011121314151617181920212223242526272829303132
  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 TeamAAS_VP.ValueConverter
  10. {
  11. public class ObjectToVisibilityConverter : IValueConverter
  12. {
  13. public bool Invert { get; set; } = false;
  14. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  15. {
  16. if (value != null)
  17. {
  18. return Invert? Visibility.Collapsed : Visibility.Visible;
  19. }
  20. else
  21. {
  22. return Invert ? Visibility.Visible : Visibility.Collapsed;
  23. }
  24. }
  25. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  26. {
  27. return null ;
  28. }
  29. }
  30. }