You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 regels
850 B

  1. using BPA.UIControl.Commons;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Globalization;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows.Data;
  9. namespace BPA.UIControl.Converters
  10. {
  11. /// <summary>
  12. /// 枚举获取说明
  13. /// </summary>
  14. public class EnumGetDescriptionConverter : IValueConverter
  15. {
  16. /// <inheritdoc/>
  17. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  18. {
  19. var enumValue = ValidateArgument.NotNullOrEmptyCast<Enum>(value, "value");
  20. return enumValue.GetDescription();
  21. }
  22. /// <inheritdoc/>
  23. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  24. {
  25. return Binding.DoNothing;
  26. }
  27. }
  28. }