VisibilityConverter.cs 632 B

1234567891011121314151617181920212223242526
  1. using System;
  2. using System.Globalization;
  3. using System.Windows;
  4. using System.Windows.Data;
  5. namespace MECF.Framework.UI.Client.Ctrlib.Converter
  6. {
  7. public class VisibilityConverter : IValueConverter
  8. {
  9. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  10. {
  11. int target = 1;
  12. if (parameter != null)
  13. {
  14. target = int.Parse(parameter.ToString());
  15. }
  16. return (int)value == target ? Visibility.Visible : Visibility.Hidden;
  17. }
  18. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  19. {
  20. throw new NotImplementedException();
  21. }
  22. }
  23. }