Enum Property Editor

Used for enumeration properties which are decorated with FlagsAttribute, displays these properties using CheckedComboBox or CheckedListBox controls. Standard manner of displaying is also supported.

The following code snippet demonstrates EnumPropertyEditorObject business class that includes MyDaysOfWeek and MyMonths enum type properties with FlagsAttributte.

You can view the code used in this lesson in the Xafari.XtraEditors.Module | Editors| EnumPropertyEditorObject.cs file of the Xafari XtraEditors demo installed with the product.

To use Enum Property Editor, invoke Model Editor and focus the corresponding BOModel|Class|OwnMembers|Member node, set PropertyEditorType property to the WinEnumPropertyEditor (or WebEnumPropertyEditor) value.

Enum Property Editor

Set EnumViewType property to specify the control to display enumeration.

Enum Property Editor

Standard value specifies the simple combo box, in the same manner as XAF displays enumeration properties. CheckedComboBox and CheckedListBox allow checking a few items. Enum Property Editor exposes a number of additional properties for the flexible customization:

ColumnsCount property specifies the count of columns within control when using CheckedComboBox.

DisplayItemImages property specifies whether CheckedListBox to display item images.

DefaultItemImageName property specifies the default image. The code snippet above demonstrates, how to define item images using ImageName Attribute. In a situation when defined images are not available, the application uses the default image.

AllItemsInclude property specifies whether or not to show the “All” item.

AllItemsItemImageName property specifies the image for the “All” item.

AllItmsName property specifies the caption for the “All” item.

After the all customization is completed, run the WinForms or ASP.NET application. Select the appropriate item in the navigation control and click the New Action. In the invoked Detail View you can use Xafari Enum Property Editor.

The Image below shows WinForms application screenshot where Day property is displayed via the CheckedListBox control with custom images. Month property is displayed via the CheckedComboBox control, the count of columns is 3. Both properties are displayed with “All” item.

Enum Property Editor

The image below shows ASP.NET application screenshots. Day property is displayed via the CheckedListBox without images, “All” item has “Select All” caption. Month property is displayed via the CheckedComboBox control, the count of columns is 2. “All” item is not displayed.

Enum Property Editor