| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Data;
- namespace TeamAAS_VP.ValueConverter
- {
-
- public class BooleanToVisibilityConverter : IValueConverter
- {
- public bool Invert { get; set; } = false;
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value != null && value is bool b)
- {
- if (Invert)
- {
- return b ? Visibility.Collapsed : Visibility.Visible;
- }
- else
- {
- return b ? Visibility.Visible : Visibility.Collapsed;
- }
- }
- else
- {
- return Visibility.Collapsed;
- }
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return value is Visibility visibility && visibility == Visibility.Visible;
- }
- }
- }
|