bool2VisibilityConverter.cs 929 B

123456789101112131415161718192021222324252627282930313233343536
  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.Media;
  7. using System.Windows;
  8. using DataAnalysisControl.Core;
  9. namespace Aitex.UI.Charting.Converter
  10. {
  11. public class bool2VisibilityConverter : IValueConverter
  12. {
  13. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  14. {
  15. try
  16. {
  17. if ((bool)value)
  18. return Visibility.Visible;
  19. return Visibility.Hidden;
  20. }
  21. catch (Exception ex)
  22. {
  23. CONTEXT.WriteLog(ex);
  24. }
  25. return Visibility.Hidden;
  26. }
  27. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  28. {
  29. return null;
  30. }
  31. }
  32. }