Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

Date and Time Properties

  • 3 minutes to read

XAF supports Property Editors for DateTime, Nullable DateTime, and TimeSpan types on all platforms.

Refer to the following topics for information on how to add Date and Time properties to business classes in the supported ORM systems:

WinForms

Each WinForms Property Editor comes with a control that displays a corresponding property in a Detail View and a repository item that displays this property in a List Editor that supports in-place editing.

WinForms Date Time property editors

DatePropertyEditor

Control: DateTimeEdit (a DateEdit descendant).

Repository Item: RepositoryItemDateTimeEdit (a RepositoryItemDateEdit descendant).

Description

This Property Editor is used for DateTime properties and applies the DateTime mask type to store and display values. To set the mask, specify one of the following:

  • The Property Editor’s EditMask property in code
  • The Views | <DetailView> | Items | <PropertyEditor> node’s IModelCommonMemberViewItem.EditMask property in the Model Editor

Do one of the following to invoke a drop-down calendar:

  • Press Alt + Down Arrow
  • Click the editor’s arrow
  • Double-click the editor

In the invoked calendar, you can select any date or the current date (at the top of the calendar). Click Clear to set the editor value to null.

You can perform date operations without the drop-down calendar. For example, press the Space key to enter a date from the keyboard. To clear the editor value, press Ctrl+0 or Ctrl+Delete.

TimeSpanPropertyEditor

Control: TimeSpanEdit (a TextEdit descendant).

Repository Item: RepositoryItemTimeSpanEdit (a RepositoryItemTextEdit descendant).

Description

The default value of this Property Editor’s EditMaskType property is RegEx. This means that you can use extended regular expressions to specify the EditMask (in code or in the Model Editor). To switch the mask type, change the EditMaskType property value. Then, use a View Controller to access the corresponding TimeSpanPropertyEditor instance and specify a mask for it. For more information, refer to the following topic: Access Editor Settings.

ASP.NET Web Forms

Web Forms  Date Time property editors

Each ASP.NET Web Forms Property Editor includes controls that display a property in a Detail View in View and Edit mode.

ASPxDateTimePropertyEditor

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

Edit mode control: ASPxEditors Library’s ASPxDateEdit editor.

Description:

This is the default Property Editor for DateTime properties.

It uses the specified mask to store and display values. 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.

ASPxTimeSpanPropertyEditor

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

Edit mode control: ASPxEditors Library’s ASPxTextBox editor.

Description:

This is the default Property Editor for TimeSpan properties.

Inherited from the ASPxStringPropertyEditor class.

ASP.NET Core Blazor

Blazor Date Time property editors

In ASP.NET Core Blazor, the ViewItem.Control property returns an IComponentContentHolder descendant. Its ComponentModel property returns a IComponentModel descendant that wraps properties and events of a corresponding Blazor Editor.

DateTimePropertyEditor

IComponentContentHolder descendant: DevExpress.ExpressApp.Blazor.Editors.Adapters.DxDateEditAdapter<T>.

Component: DevExpress ASP.NET Core Blazor Library’s DxDateEdit<T> editor.

Description:

This is the default Property Editor for DateTime properties.

TimeSpanPropertyEditor

IComponentContentHolder descendant: DevExpress.ExpressApp.Blazor.Editors.Adapters.DxTimeEditAdapter<T>.

Component: DevExpress ASP.NET Core Blazor Library’s DxTimeEdit<T> editor.

Description:

This is the default Property Editor for TimeSpan properties.

See Also