ServiceModeConvert.cs 783 B

123456789101112131415161718192021222324252627282930
  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. namespace Aitex.Core.UI.Converters
  8. {
  9. public class ServiceModeConvert : IValueConverter
  10. {
  11. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  12. {
  13. bool vInOnOff = false;
  14. if (value != null)
  15. {
  16. bool.TryParse(value + "", out vInOnOff);
  17. }
  18. return vInOnOff ? Visibility.Visible : Visibility.Collapsed;
  19. }
  20. public object ConvertBack(object value, Type targetTypes, object parameter, System.Globalization.CultureInfo culture)
  21. {
  22. return null;
  23. }
  24. }
  25. }