Skip to main content
A newer version of this page is available. .

DateEdit Class

The editor to edit date/time values using a dropdown calendar.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v17.2.dll

Declaration

[ToolboxBitmap(typeof(ToolboxIconsRootNS), "DateEdit")]
[DefaultBindingPropertyEx("DateTime")]
[ToolboxTabName("DX.17.2: Common Controls")]
public class DateEdit :
    PopupBaseEdit,
    IDateRangeCollectionOwner

Remarks

The DateEdit control allows date/time values to be entered using a dropdown calendar or via an edit box.

DateEdit-class

The DateEdit control’s properties are specified by the RepositoryItemDateEdit class and they can be accessed using the DateEdit.Properties property. To specify a date/time value for standalone editors, use the DateEdit.DateTime property.

The following calendar styles are supported (you can choose them using the RepositoryItemDateEdit.CalendarView property).

Calendar Style

Description

CalendarView.Vista

The Vista-style calendar:

DateEdit-CalendarView-Vista

CalendarView.TouchUI

The touch-aware date-editing UI:

DateEdit-CalendarView-TouchUI

CalendarView.Classic

The classic calendar:

DateEdit-CalendarView-Classic

In the Vista and Classic modes, the calendar contains the Today button. This button’s visibility is specified by the RepositoryItemDateEdit.ShowToday property. The calendar in the Classic mode also contains the Clear button, whose visibility is controlled by the RepositoryItemDateEdit.ShowClear property. A click on this button sets the editor’s edit value to the RepositoryItemDateEdit.NullDate property’s value (null by default).

An end-user can set the edit value to null by pressing the CTRL+0 or CTRL+DEL shortcuts. See the RepositoryItemTextEdit.AllowNullInput topic for more information.

By default, a date editor works in the DateTime masked mode (its MaskProperties.MaskType property is set to MaskType.DateTime). This mask mode is used to enter date/time values using one of the standard or custom date/time patterns. The required pattern can be set via the synchronized RepositoryItemDateEdit.EditMask and MaskProperties.EditMask properties. By default, these are set to “d” (short date pattern). Refer to the Mask Type: Date-time topic for information on the available date/time patterns. This document also provides information on the end-user capabilities available for entering date/time values in the DateTime masked mode.

A date editor is not limited to use in the DateTime masked mode. It’s possible to enable other masked modes or disable the mask functionality completely. To do this, set the MaskProperties.MaskType property to an appropriate value. For instance, using the DateTimeAdvancingCaret mask mode for entering date/time values is useful if date separators should be automatically skipped during editing.

Note

The date/time masks only support the following calendars: Gregorian, Korean, Taiwan, and Thai Buddhist.

In the Vista and TouchUI calendar modes, you can allow an end-user to edit a time value along with the date portion in the calendar. This functionality can be turned on using the RepositoryItemDateEdit.CalendarTimeEditing property. The following image shows a DateEdit with the time editing functionality enabled in the Vista mode:

DateEdit-CalendarView-Vista-EditTime

The DateEdit.DrawItem and RepositoryItemDateEdit.DrawItem events allow you to paint the cells in the dropdown calendar as required.

The following code snippets (auto-collected from DevExpress Examples) contain references to the DateEdit class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also