Disabled dates are the ones that appear disabled and are not selectable at run-time. You can add disabled dates at design-time through DateTime Collection Editor. You can also add disabled dates through code in CalendarView by setting the DisabledDates property to a DateTime array. (A DateTime constructor represents an instant in time, expressed typically as a date and time of the day.)
The following image shows disabled dates in CalendarView.
The following code snippet shows how to add disabled dates using the DisabledDates property in CalendarView:
C# |
Copy Code
|
---|---|
// Set disabled dates calendarView.DisabledDates = new DateTime[] { new DateTime(2021, 05, 16), new DateTime(2021, 05, 17), new DateTime(2021, 05, 18), new DateTime(2021, 05, 19), new DateTime(2021, 05, 20), new DateTime(2021, 05, 21), new DateTime(2021, 05, 22) }; |