TextLengthToBoolConverter.cs 891 B

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Globalization;
  3. using System.Windows.Data;
  4. namespace ComPDFKit.Controls.Common
  5. {
  6. public class TextLengthToBoolConverter: IValueConverter
  7. {
  8. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  9. {
  10. if (value == null)
  11. {
  12. return false;
  13. }
  14. else
  15. {
  16. if (value is string)
  17. {
  18. string checkStr = (string)value;
  19. if (string.IsNullOrEmpty(checkStr) == false )
  20. {
  21. return true;
  22. }
  23. }
  24. return false;
  25. }
  26. }
  27. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  28. {
  29. return null;
  30. }
  31. }
  32. }