123456789101112131415161718192021222324252627282930 |
- using System;
- using System.Globalization;
- using System.Windows;
- using System.Windows.Data;
- namespace Bolt.Toolkit.Wpf.Converters
- {
- public class BoolVisibilityConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- var v = (bool)value;
- var hide = Visibility.Hidden;
- if (parameter != null)
- {
- if ((bool)parameter)
- {
- hide = Visibility.Collapsed;
- }
- }
- return v == true ? Visibility.Visible : hide;
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|