Skip to content

Instantly share code, notes, and snippets.

@owen2
Last active August 29, 2015 14:16
Show Gist options
  • Save owen2/38842eb1802344af6f7e to your computer and use it in GitHub Desktop.
Save owen2/38842eb1802344af6f7e to your computer and use it in GitHub Desktop.
MagicComboBoxEnumConverter
public class EnumToItemsSourceConverter : IValueConverter
{
public EnumToItemsSourceConverter() : base() { }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value == null || !(value is Enum))
{
return new object[] { };
}
return Enum.GetValues(value.GetType());
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment