| 123456789101112131415161718192021222324252627 |
- using System;
- using System.Globalization;
- using System.Windows;
- using System.Windows.Data;
- using TeamAAS_VP.Enums;
- namespace TeamAAS_VP.ValueConverter
- {
- public class CommunicationTypeVisibilityConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value is CommunicationType type && parameter is string targetName
- && Enum.TryParse(targetName, out CommunicationType expected))
- {
- return type == expected ? Visibility.Visible : Visibility.Collapsed;
- }
- return Visibility.Collapsed;
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return Binding.DoNothing;
- }
- }
- }
|