Enum Property Editor | Xafari Xtra Editors
Select Page

Enum Property Editor

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

The following code snippet demonstrate 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 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.

Set EnumViewType property to specify the control to display enumeration.

Standard value specifies the simple combo box, in the same manner XAF displays enumeration properties. CheckedComboBox and CheckedListBox allows to check 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. Code snippet above demonstrates, how to define item images using ImageName Attribute. In 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.

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