Date and Time Properties
- 3 minutes to read
XAF supports Property Editors for the following types and their nullable variants on all platforms:
DateTime
DateOnly
TimeSpan
TimeOnly
Refer to the following topics for information on how to add Date and Time properties to business classes in the supported ORM systems:
ASP.NET Core Blazor
In ASP.NET Core Blazor, BlazorPropertyEditorBase.ComponentModel returns an IComponentModel
descendant that wraps properties and events of a corresponding ASP.NET Core Blazor Editor.
DateTimePropertyEditor
Component Model: DevExpress.ExpressApp.Blazor.Components.Models.DxDateEditModel<T>
.
Component: DevExpress ASP.NET Core Blazor Library’s DxDateEdit<T> editor.
Description:
This is the default Property Editor for DateTime
and DateOnly
(EF Core) properties. Access the DxDateEditMaskProperties
property to modify the Component mask properties.
TimeSpanPropertyEditor
Component Model: DevExpress.ExpressApp.Blazor.Components.Models.DxTimeEditModel<T>
.
Component: DevExpress ASP.NET Core Blazor Library’s DxTimeEdit<T> editor.
Description:
This is the default Property Editor for TimeSpan
and TimeOnly
(EF Core) properties. Access the DxTimeEditMaskProperties
property to modify the Component’s mask properties.
Windows Forms
Each Windows Forms Property Editor is available in two forms:
- A standalone control (displays property value in a Detail View)
- A repository item (displays property value in a List Editor that supports in-place editing)
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 way 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 the Settings of a Property Editor in a Detail View.
ASP.NET Web Forms
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.
The editor is inherited from the ASPxStringPropertyEditor
class.