BoolVisibilityConverter.cs 785 B

123456789101112131415161718192021222324252627
  1. using System;
  2. using System.Windows;
  3. using System.Windows.Data;
  4. namespace Muchinfo.MTPClient.Infrastructure.Converters
  5. {
  6. public class BoolVisibilityConverter : IValueConverter
  7. {
  8. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  9. {
  10. if (value == null)
  11. {
  12. return Visibility.Collapsed;
  13. }
  14. if (value.Equals(true))
  15. {
  16. return Visibility.Visible;
  17. }
  18. return Visibility.Collapsed;
  19. }
  20. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  21. {
  22. throw new NotImplementedException();
  23. }
  24. }
  25. }