Bools2BoolConverter.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 Bools2BoolConverter : IMultiValueConverter
  12. {
  13. public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  14. {
  15. try
  16. {
  17. bool isHid1 = (bool)values[0];
  18. bool isHid2 = (bool)values[1];
  19. return !(isHid1 && isHid2);
  20. }
  21. catch (Exception ex)
  22. {
  23. CONTEXT.WriteLog(ex);
  24. }
  25. return false;
  26. }
  27. public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
  28. {
  29. try
  30. {
  31. var b = (bool)value;
  32. if (b)
  33. return new object[] { false, false };
  34. return new object[] { true,true };
  35. }
  36. catch (Exception ex)
  37. {
  38. CONTEXT.WriteLog(ex);
  39. }
  40. return new object[] { true, true };
  41. }
  42. }
  43. }