Don't know about WPF but in webforms (since I use MVP) I bind a List> to the ddl. To get the list here is some code
var pairs = new List<KeyValuePair<string, string>>();
pairs.Add(new KeyValuePair<string, string>("Please Select", String.Empty));
for (int i = 0; i < typeof(DepartmentEnum).GetFields().Length - 1; i++)
{
DepartmentEnum de = EnumExtensions.NumberToEnum<DepartmentEnum>(i);
pairs.Add(new KeyValuePair<string, string>(de.ToDescription(), de.ToString()));
}
MyView.Departments = pairs;
It uses extension methods on the enum:
public static class EnumExtensions
{
public static string ToDescription(this Enum en)
{
Type type = en.GetType();
MemberInfo[] memInfo = type.GetMember(en.ToString());
if (memInfo != null && memInfo.Length > 0)
{
object[] attrs = memInfo[0].GetCustomAttributes(typeof(DescriptionAttribute),false);
if (attrs != null && attrs.Length > 0)
return ((DescriptionAttribute)attrs[0]).Description;
}
return en.ToString();
}
public static TEnum NumberToEnum<TEnum>(int number )
{
return (TEnum)Enum.ToObject(typeof(TEnum), number);
}
}