In the last post of this series, we introduced the ColorEditBox control, which is part of the new WinRT/XAML Editors product. In today's post, we'll take a look at the EnumEditBox control, which makes it easy to select enumeration values.
Windows Store Variant
The EnumEditBox control is used to input an Enum value, and uses an EnumPicker control in its popup.
The screenshot above shows off how the popup renders a flags-based enumeration, where multiple selections can be made. For non-flags enumerations, the popup looks more like a standard single-selection list:
It's very easy to get going with the control. Simply set the enumeration type and bind a value and it takes care of the rest for you.
Edit boxes work great with a keyboard. When the edit box is focused, values can be directly typed in. Type in "Three" and press Enter. The value will get committed. You can also use keyboard arrow keys, PgUp/PgDn, or the mouse wheel to increment values.
If the user doesn't have a keyboard, mouse or touch can be used to display the popup. The picker on the popup uses large items, making for easy mouse/touch selection.
Anther great feature of the control is the ability to use DisplayAttribute attributes on the enumeration values to specify alternate display text for each enum value. Custom value sorting algorithms can be set as well.
Windows Phone Variant
Just like our other edit boxes, this edit box will render itself like a button when used on Windows Phone. Tapping the button shows a full screen picker (same as above) where the enum values can be selected.
Summary
This post shows how an EnumEditBox control can make it simple for an end user to select an enumeration value within a Windows Store or Windows Phone app. Download our WinRT/XAML Controls to check it out, along with our other beautiful and functional editor controls!