Skip to main content

DateEdit.DisableCalendarDate Event

Allows you to disable specific dates in the drop-down calendar.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v25.2.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DXCategory("Events")]
public event DisableCalendarDateEventHandler DisableCalendarDate

Event Data

The DisableCalendarDate event's data class is DevExpress.XtraEditors.Calendar.DisableCalendarDateEventArgs.

Remarks

Handle the DisableCalendarDate event to prevent users from selecting specific dates or date ranges. The event fires for each day cell in the drop-down calendar before it is rendered. Set the e.Disabled event parameter to true to disable the processed date.

The following code snippet disables all weekend dates in the drop-down calendar:

using DevExpress.XtraEditors.Controls;

dateEdit1.DisableCalendarDate += (sender, e) => {
    if (e.Date.DayOfWeek == DayOfWeek.Saturday || e.Date.DayOfWeek == DayOfWeek.Sunday)
        e.IsDisabled = true;
};

The following screenshot illustrates the result:

Disable Weekends - WinForms DateEdit, DevExpress

The DisableCalendarDate event is equivalent to RepositoryItemDateEdit.DisableCalendarDate.

See Also