public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { if (!targetType.IsEnum || value.GetType() != typeof(String)) { throw new ArgumentException(); } return(EnumText.GetEnumValue(value as String, targetType)); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (targetType != typeof(String) || !value.GetType().IsEnum) { throw new ArgumentException(); } return(EnumText.GetStringValue(value as Enum)); }