|
- 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;
- using BPASmart.Model;
-
-
- namespace BPASmart.VariableManager.Converter
- {
- public class DeviceVisibleConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- Type type = value?.GetType();
-
- if (type != null && parameter != null)
- {
- string typeName = type.BaseType.Name == "Object" ? type.Name : type.BaseType.Name;
- if (typeName == parameter.ToString())
- return Visibility.Visible;
- else
- return Visibility.Collapsed;
- }
- return default;
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|