RobotBrandToVisibiltyConverter.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  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 TeamAAS_VP.Enums;
  10. namespace TeamAAS_VP.ValueConverter
  11. {
  12. public class RobotBrandToVisibiltyConverter : IValueConverter
  13. {
  14. public bool Inverse { get; set; } = false;
  15. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  16. {
  17. if (value != null && value is RobotBrand robotBrand)
  18. {
  19. if (robotBrand== RobotBrand.XYZ_Platform || robotBrand== RobotBrand.XYZU_Platform || robotBrand == RobotBrand.XYZUR_Platform || robotBrand == RobotBrand.XYZURWV_Platform)
  20. {
  21. return Inverse ? Visibility.Visible : Visibility.Collapsed;
  22. }
  23. return Inverse ? Visibility.Collapsed : Visibility.Visible;
  24. }
  25. else
  26. {
  27. return Visibility.Collapsed;
  28. }
  29. }
  30. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  31. {
  32. return Binding.DoNothing;
  33. }
  34. }
  35. }