ValveVisibleConvert.cs 855 B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows.Data;
  6. using System.Windows;
  7. using Aitex.Core.UI.ControlDataContext;
  8. namespace Aitex.Core.UI.Converters
  9. {
  10. public class ValveVisibleConvert : IValueConverter
  11. {
  12. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  13. {
  14. bool vInOnOff = false;
  15. if (value != null)
  16. {
  17. bool.TryParse((value as GasValveDataItem).Feedback + "", out vInOnOff);
  18. }
  19. return vInOnOff ? Visibility.Visible : Visibility.Collapsed;
  20. }
  21. public object ConvertBack(object value, Type targetTypes, object parameter, System.Globalization.CultureInfo culture)
  22. {
  23. return null;
  24. }
  25. }
  26. }