Boolean Properties
- 2 minutes to read
In XAF, Boolean and Nullable Boolean properties can be displayed in WinForms and ASP.NET applications through:
- a CheckEdit control (default);
- a drop-down control where custom text (when this text is specified in the Application Model using the IModelCommonMemberViewItem.CaptionForTrue and IModelCommonMemberViewItem.CaptionForFalse properties) displays Boolean values;
- a drop-down control where images and text (when images are specified in the Application Model using the IModelCommonMemberViewItem.ImageForTrue and IModelCommonMemberViewItem.ImageForFalse properties) display Boolean values;
XAF Mobile applications use the dxSwitch widget to display Boolean properties.
Note
Refer to the Property Editors | Boolean Properties section in the Feature Center demo installed with XAF to see Boolean 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 https://demos.devexpress.com/XAF/FeatureCenter/.
Examples
WinForms Property Editors for Boolean 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.
BooleanPropertyEditor
Controls:
- BooleanEdit - a descendant of the XtraEditors Library’s CheckEdit editor;
- BoolComboBoxEdit - a descendant of the XtraEditors Library’s ImageComboBoxEdit editor.
Repository Items:
- RepositoryItemBooleanEdit - a descendant of the XtraEditors Library’s RepositoryItemCheckEdit item;
- RepositoryItemBoolComboBoxEdit - a descendant of the XtraEditors Library’s RepositoryItemImageComboBox item.
Description:
The BooleanEdit control and the RepositoryItemBooleanEdit repository item are used by default.
The BoolComboBoxEdit control and RepositoryItemBoolComboBoxEdit repository item are used if at least one of the following pairs are specified:
- IModelCommonMemberViewItem.CaptionForFalse and IModelCommonMemberViewItem.CaptionForTrue;
- IModelCommonMemberViewItem.ImageForFalse and IModelCommonMemberViewItem.ImageForTrue.
ASP.NET Property Editors for Boolean 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.
ASPxBooleanPropertyEditor
View mode controls:
- ASPxImageLabelControl;
- ASPxCheckBox.
Edit mode controls:
Description:
Used to display Boolean properties.
The ASPxCheckBox control is used in both View and Edit modes by default.
The ASPxImageLabelControl control and ASPxComboBox controls are used in the View and Edit modes, if at least one of the following pairs are specified:
- IModelCommonMemberViewItem.CaptionForFalse and IModelCommonMemberViewItem.CaptionForTrue;
- IModelCommonMemberViewItem.ImageForFalse and IModelCommonMemberViewItem.ImageForTrue.
Mobile Property Editor for Boolean Properties
The MobileBooleanPropertyEditor property editor uses the Switch control. This control uses the dxSwitch widget to display Boolean properties in the Detail View‘s View and Edit modes (see DetailView.ViewEditMode).