RiskLevelToVisibilityConverter.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows;
  6. using System.Windows.Data;
  7. namespace Muchinfo.MTPClient.Infrastructure.Converters
  8. {
  9. public class RiskLevelToVisibilityConverter : IValueConverter
  10. {
  11. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  12. {
  13. if (value == null || value.ToString() == "" || decimal.Parse(value.ToString())==-1)
  14. {
  15. return Visibility.Collapsed;
  16. }
  17. if (decimal.Parse(value.ToString()) >= 0)
  18. {
  19. return Visibility.Visible;
  20. }
  21. return Visibility.Collapsed;
  22. }
  23. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  24. {
  25. throw new NotImplementedException();
  26. }
  27. }
  28. public class RiskLevelToVisibilityDifConverter : IValueConverter
  29. {
  30. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  31. {
  32. if (value == null || value.ToString() == "" || decimal.Parse(value.ToString()) == -1)
  33. {
  34. return Visibility.Visible;
  35. }
  36. if (decimal.Parse(value.ToString()) >= 0)
  37. {
  38. return Visibility.Collapsed;
  39. }
  40. return Visibility.Visible;
  41. }
  42. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  43. {
  44. throw new NotImplementedException();
  45. }
  46. }
  47. }