DateEdit Class
The editor to edit date/time values using a dropdown calendar.
Namespace: DevExpress.XtraEditors
Assembly: DevExpress.XtraEditors.v22.2.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
[DefaultBindingPropertyEx("DateTime")]
public class DateEdit :
PopupBaseEdit,
IDateRangeCollectionOwner
Remarks
The DateEdit
control allows users to specify date/time values using a dropdown calendar and edit box.
The DateEdit.Properties property (a RepositoryItemDateEdit class instance) contains the DateEdit
control’s various settings.
Use the RepositoryItemDateEdit.CalendarView property to choose a calendar style:
Calendar Style | Description |
---|---|
CalendarView.Fluent | The calendar that supports the Acrylic and Reveal Highlight effects and allows you to mirror the appearance of the Windows 10 calendar.
|
CalendarView.Vista | The Vista-style calendar:
|
CalendarView.TouchUI | The touch-aware date-editing UI:
For a DateEdit control, the control’s mask (see the RepositoryItemTextEdit.Mask inherited property) specifies which date-time columns are displayed in the dropdown calendar. To display time columns, enable the RepositoryItemDateEdit.CalendarTimeEditing option. |
CalendarView.Classic | The classic calendar:
|
CalendarView.ClassicNew | An Outlook 2016-inspired calendar style.
|
Main Settings and Events
- DateEdit.DateTime - Specifies the control’s edit value (for standalone editors).
- RepositoryItemDateEdit.ShowToday - Gets or sets whether to display the Today button in the dropdown calendar (in Classic and Vista modes).
- RepositoryItemDateEdit.ShowClear - Gets or sets whether the dropdown calendar contains the Clear button (this button is not supported in CalendarView.TouchUI mode).
- RepositoryItemTextEdit.AllowNullInput - Gets or sets whether end-users can reset the editor’s value to null via keyboard. The edit value is reset to Color.Empty for the ColorEdit and ColorPickEdit controls.
- RepositoryItemDateEdit.CalendarTimeEditing - Gets or sets whether an end-user can edit the time portion of a date value in the dropdown calendar.
- RepositoryItemDateEdit.DrawItem (DateEdit.DrawItem) - Provides the ability to custom paint day cells in the dropdown calendar.
- DisableCalendarDate ( DisabledDateProvider ) - Allows you to disable specific dates.
- MinValue / MaxValue - Specify the allowed range of dates.
Masked Input
By default, DateEdit functions in the DateTime masked mode, which allows you to enter date/time values using one of the standard or custom date/time patterns. Use the RepositoryItemDateEdit.EditMask property to switch from the default pattern (short date -“d”) to another one.
Set the MaskProperties.MaskType (DateEdit.Properties.Mask.MaskType) property to DateTimeAdvancingCaret to allow the caret to automatically skip date separators while entering date/time values.
Note
The date/time masks only support the following calendars: Gregorian, Korean, Taiwan, and Thai Buddhist.
Bind to Data Source
If you need to bind the DateEdit control to a field in an underlying data source/business object, we recommend that this field stores date/time values.
If the DateEdit is bound to a string field, the editor value is updated according to the current culture. For instance, day and month date portions can swap places. In this case, you need to manually parse editor values:
Enter Date-Time Values
See the following topic to learn about the editors you can use to enter date-time values: How to: Enter date-time values.