Back to Devexpress

TimeRegion.ExceptionDates Property

windowsforms-devexpress-dot-xtrascheduler-dot-timeregion-61194714.md

latest3.0 KB
Original Source

TimeRegion.ExceptionDates Property

Gets or sets the list of dates free of this recurring time region.

Namespace : DevExpress.XtraScheduler

Assembly : DevExpress.XtraScheduler.v25.2.dll

NuGet Package : DevExpress.Win.Scheduler

Declaration

csharp
public IList<DateTime> ExceptionDates { get; set; }
vb
Public Property ExceptionDates As IList(Of Date)

Property Value

TypeDescription
IList<DateTime>

The List of dates that do not display this recurring time region.

|

Remarks

When you specify the time region recurrence pattern (see the TimeRegion.Recurrence property), you can add specific dates to the ExceptionDates collection to remove the time region from these dates.

In the code below, the timeRegion1 repeats every work day and lasts for 1 hour starting from 1p.m. This region does not appear at March 21, 2019 because this date is added to the ExceptionDates list.

csharp
DateTime baseDate = DateTimeHelper.GetStartOfWeek(DateTime.Today);
baseDate = baseDate.AddDays(-15);

//Region #1 - 1p.m. to 2p.m., repeats every work day
TimeRegion timeRegion1 = new TimeRegion();
timeRegion1.Start = baseDate.AddHours(13);
timeRegion1.End = baseDate.AddHours(14);
timeRegion1.Editable = false;
timeRegion1.Recurrence = new RecurrenceInfo();
timeRegion1.Recurrence.Start = timeRegion1.Start;
timeRegion1.Recurrence.Type = RecurrenceType.Weekly;
timeRegion1.Recurrence.WeekDays = WeekDays.WorkDays;
timeRegion1.ExceptionDates.Add(new DateTime(2019, 3, 21, 13, 0, 0));
scheduler.TimeRegions.Add(timeRegion1);
vb
Dim baseDate As Date = DateTimeHelper.GetStartOfWeek(Date.Today)
baseDate = baseDate.AddDays(-15)

'Region #1 - 1p.m. to 2p.m., repeats every work day
Dim timeRegion1 As New TimeRegion()
timeRegion1.Start = baseDate.AddHours(13)
timeRegion1.End = baseDate.AddHours(14)
timeRegion1.Editable = False
timeRegion1.Recurrence = New RecurrenceInfo()
timeRegion1.Recurrence.Start = timeRegion1.Start
timeRegion1.Recurrence.Type = RecurrenceType.Weekly
timeRegion1.Recurrence.WeekDays = WeekDays.WorkDays
timeRegion1.ExceptionDates.Add(New Date(2019, 3, 21, 13, 0, 0))
scheduler.TimeRegions.Add(timeRegion1)

See Also

TimeRegion Class

TimeRegion Members

DevExpress.XtraScheduler Namespace