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

Date and Time Properties

  • 4 min to read

XAF supports property editors for DateTime and Nullable DateTime types on all platforms, and the TimeSpan type in WinForms and ASP.NET applications.

Note

Refer to the Property Editors | DateTime Properties section in the Feature Center demo installed with XAF to see Date and Time 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 Date and Time 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.

DatePropertyEditor

Control: DateTimeEdit - a descendant of the XtraEditors Library's DateEdit editor.

Repository Item: RepositoryItemDateTimeEdit - a descendant of the XtraEditors Library's RepositoryItemDateEdit item.

Description:

Used for DateTime type properties by default.

Stores and displays values using the DateTime mask type. To set a mask, use the Property Editor's EditMask property in code, or the Views | <DetailView> | Items | <PropertyEditor> node's IModelCommonMemberViewItem.EditMask property in the Model Editor.

Click the editor's arrow or double-click the editor to invoke a drop-down calendar. In the invoked calendar, click the current date at the top, select a date or click Clear to empty the editor's value.

You can type a date without using the drop-down calendar by pressing the Space bar. To clear the editor's value without using the drop-down calendar, press CTRL+0 or CTRL+DELETE. Use Alt + Down Arrow to expand the DateTimeEdit drop-down window.

TimeSpanPropertyEditor

Control: TimeSpanEdit - a descendant of the XtraEditors Library's TextEdit editor.

Repository Item: RepositoryItemTimeSpanEdit - a descendant of the XtraEditors Library's RepositoryItemTextEdit item.

Description:

Used for TimeSpan type properties by default.

This Property Editor has the EditMaskType property, which is set to RegEx by default. This means that you can specify the EditMask (in code or the Model Editor) using extended regular expressions. You can also set the EditMaskType property to the required mask type and specify the mask by accessing the required TimeSpanPropertyEditor instance using a View Controller (see Access Editor Settings).

ASP.NET Property Editors for Date and Time 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.

ASPxDateTimePropertyEditor

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

Edit mode control: ASPxEditors Library's ASPxDateEdit editor.

Description:

Used for DateTime type properties by default.

Stores and displays values using the specified mask. To set a mask, use the Property Editor's EditMask property in code, or the Views | <DetailView> | Items | <PropertyEditor> node's IModelCommonMemberViewItem.EditMask property in the Model Editor.

Click the editor's arrow or double-click the editor to invoke a drop-down calendar. In the invoked calendar, click the current date at the top, select a date, or click Clear to empty the editor's value.

Click the editor's arrow to invoke a drop-down calendar. In the invoked calendar, click Today at the bottom, select a date, or click Clear to empty the editor's value. You can type a date without using the drop-down calendar. Press Alt + Down Arrow to expand the DateTimeEdit's drop-down window.

ASPxTimeSpanPropertyEditor

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

Edit mode control: ASPxEditors Library's ASPxTextBox editor.

Description:

Used for TimeSpan type properties by default.

Inherited from the ASPxStringPropertyEditor class.

Mobile Property Editors for Date and Time 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.

MobileDateTimePropertyEditor

View mode control: Label that displays text using the div HTML element.

Edit mode control: DateBox that uses the dxDateBox widget.

Description:

Used for DateTime type properties by default.

Click the editor to invoke a pop-up calendar. In the invoked calendar, swipe up or down to set the month, day and year values and click the Done button.

You can not type a date without using the pop-up calendar.

See Also