终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

37 lines
1.0 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Data;
  9. using BPASmart.Model;
  10. namespace BPASmart.VariableManager.Converter
  11. {
  12. public class DeviceVisibleConverter : IValueConverter
  13. {
  14. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  15. {
  16. Type type = value?.GetType();
  17. if (type != null && parameter != null)
  18. {
  19. string typeName = type.BaseType.Name == "Object" ? type.Name : type.BaseType.Name;
  20. if (typeName == parameter.ToString())
  21. return Visibility.Visible;
  22. else
  23. return Visibility.Collapsed;
  24. }
  25. return default;
  26. }
  27. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  28. {
  29. throw new NotImplementedException();
  30. }
  31. }
  32. }