public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { IngredientUnit unit = (IngredientUnit)value; FieldInfo field = value.GetType().GetField(unit.ToString()); DescriptionAttribute[] attributes = (DescriptionAttribute[])field.GetCustomAttributes( typeof(DescriptionAttribute), false); if (attributes != null && attributes.Length > 0) { return(attributes[0].Description); } else { return(unit.ToString()); } }