BoolToVisibilityConverter.cs 609 B

1234567891011121314151617181920
  1. using System;
  2. using System.Globalization;
  3. using System.Windows;
  4. using System.Windows.Data;
  5. namespace SWRIS.Converters
  6. {
  7. public class BoolToVisibilityConverter : IValueConverter
  8. {
  9. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  10. {
  11. return value != null && value is bool isEnable && isEnable ? Visibility.Visible : Visibility.Collapsed;
  12. }
  13. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  14. {
  15. throw new NotImplementedException();
  16. }
  17. }
  18. }