The requested page is not available for the requested platform. You are viewing the content for Default platform.

Enumeration Properties

  • 4 min to read

In XAF, enumeration properties can be displayed in the following manner:

WinForms and ASP.NET

  • A combo box with text entries (default). You can associate custom texts with enumeration values using the XafDisplayNameAttribute attribute.
  • A combo box with text and image entries (when images are associated with the enumeration values using the ImageNameAttribute attribute).

You can also display an integer property as an enumeration.

Mobile

  • In Edit mode, a lookup widget with the text entries. You can associate custom texts with enumeration values using the XafDisplayNameAttribute attribute.
  • In View mode, a text and image entries (when images are associated with the enumeration values using the ImageNameAttribute attribute).

PE_EnumMobile

Note

Refer to the Property Editors | Enum Properties section in the Feature Center demo installed with XAF to see Enumeration Property Editors in action. The Feature Center demo is installed in %PUBLIC%\Documents\DevExpress Demos 19.1\Components\eXpressApp Framework\FeatureCenter by default. The ASP.NET version of this demo is available online at http://demos.devexpress.com/XAF/FeatureCenter/.

Examples

WinForms Property Editors for Enumeration Properties

Each WinForms Property Editor has a control that displays a corresponding property in a Detail View, and a repository item that displays a property in a List Editor that supports in-place editing. Both the control and repository item are shown below.

EnumPropertyEditor

Control: EnumEdit - a descendant of the XtraEditors Library's ImageComboBoxEdit editor.

Repository Item: RepositoryItemEnumEdit - a descendant of the XtraEditors Library's RepositoryItemButtonEdit item.

Description:

Used for enumeration type properties by default.

You can specify images for combo box items. This Property Editor uses the EnumDescriptor class to get images and localized item captions. Refer to the How to: Set Images and Captions for Enumeration Values topic for details.

Use Alt + Down Arrow to expand the EnumEdit's drop-down window.

EnumIntPropertyEditor<TEnum>

Control: EnumIntEdit - a descendant of the XtraEditors Library's ImageComboBoxEdit editor.

Repository Item: RepositoryItemEnumIntEdit - a descendant of the XtraEditors Library's RepositoryItemImageComboBox item.

Description:

The base class for custom WinForms Property Editors, intended to display integer properties as enumerations.

Note that you cannot directly assign this Property Editor type to the BOModel | <Class> | OwnMembers | <Member> node's IModelCommonMemberViewItem.PropertyEditorType property in the Model Editor. Instead, inherit this Property Editor and set the TEnum generic parameter to the enumeration type that is mapped to the current integer property. Then, you can set this Property Editor type for the PropertyEditorType property. Refer to the How to: Display an Integer Property as an Enumeration topic for more information.

ASP.NET Property Editors for Enumeration Properties

Each ASP.NET Property Editor has controls that display a property in a Detail View's View and Edit mode (see DetailView.ViewEditMode). These controls are listed below.

ASPxEnumPropertyEditor

View mode: System.Web.UI.WebControls.Label.

Edit mode: the ASPxEditors Library's ASPxComboBox editor.

Description:

Used for enumeration type properties by default.

You can specify images for combo box items. Refer to the How to: Set Images and Captions for Enumeration Values topic for more details. This Property Editor uses the EnumDescriptor class to get images and localized item captions.

Use Alt + Down Arrow to expand the editor's drop-down window.

ASPxEnumIntPropertyEditor<TEnum>

View mode: System.Web.UI.WebControls.Label.

Edit mode: the ASPxEditors Library's ASPxComboBox editor.

Description:

The base class for custom ASP.NET Property Editors, intended to display integer properties as enumerations.

Note that you cannot directly assign this Property Editor type to the IModelCommonMemberViewItem.PropertyEditorType property of the BOModel | <Class> | OwnMembers | <Member> node in the Model Editor. Instead, inherit this Property Editor and set the TEnum generic parameter to the enumeration type that is mapped to the current integer property. Then, you can set this Property Editor type for the PropertyEditorType property. Refer to the How to: Display an Integer Property as an Enumeration topic.

Mobile Property Editors for Enumeration Properties

Each Mobile Property Editor has widgets that display a property in a Detail View's View and Edit mode (see DetailView.ViewEditMode). These widgets are listed below.

MobileEnumPropertyEditor

View mode controls:

Edit mode control: Lookup that uses the dxLookup widget.

Description:

Used for enumeration type properties by default.

You can specify images for lookup items, but they are displayed only in View mode. This Property Editor uses the EnumDescriptor class to get localized item captions.