Public Enum Foods
Fruits
Vegetables
Meat
Dairy
Bread
Eggs
End Enum
This topic explains the behavior of the control when bound to an enum data type.
The following topic is prerequisites to understanding this topic:
When the xamComboEditor control has both its ItemsSource and ItemsProvider properties not set and the ValueType property set to an enum (or a nullable enum) type then an internal items provider is created and populates the dropdown with the values obtained from the enum type.
The enum values are extracted in the following manner:
it obtains a type converter with a call to TypeDescriptor.GetConverter(valueType)
it then enumerates over the converter’s GetStandardValues()
collection which also determines the order of the values in the dropdown
The null value of a nullable enum is handled in the following way: if the converter converts the null to a non-empty string it will be used as the display value, otherwise a localized string with a key of Nullable_Enum_NullValue_Literal
(which for English is "[null]") will be used. This resource is in the Editors assembly.
There are ways to exclude certain properties from the dropdown, change their display value or even change the order they are shown in the dropdown. All these features are described in the table below.
The following table explains briefly the configurable aspects of the enum handling feature of the xamComboEditor control.
The following topics provide additional information related to this topic.