you can create description for enum and bind itemsources to description, you only need to change enum class like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
[TypeConverter(typeof(EnumDescriptionTypeConverter))] publicenum Status { [Description("This is horrible")] Horrible, [Description("This is bad")] Bad, [Description("This is so so")] SoSo, [Description("This is good")] Good, [Description("This is better")] Better, [Description("This is best")] Best }
If you are using a built-in or third party enums and you can not add a Description attribute to it, you can use this solution:
Create an string[] Array and create your description in order
1 2 3 4 5 6
<Window.Resources> <x:ArrayType="sys:String"x:Key="myDescription"> <sys:String>Left To Right Description</sys:String> <sys:String>Right To Left Description</sys:String> </x:Array> </Window.Resources>
Do not forget that in this case you must use DisplayMemberPath. If DisplayMemberPath is set to Value, it displays the Description value and if DisplayMemberPath is set to Key, it displays Enum itself.
Localized Description
you can use this attribute for localize enum
1 2 3 4 5 6 7 8 9 10
[TypeConverter(typeof(EnumDescriptionTypeConverter))] publicenum Status { [LocalizedDescription("Good", typeof(LangResources))] Good, [LocalizedDescription("Better", typeof(LangResources))] Better, [LocalizedDescription("Best", typeof(LangResources))] Best }