TimeRegion.Recurrence Property
Provides access to settings that specify the rule (pattern), according to which this region reoccurs.
Namespace: DevExpress.XtraScheduler
Assembly: DevExpress.XtraScheduler.v19.2.dll
Declaration
Property Value
Type | Description |
---|---|
RecurrenceInfo | Stores recurrence settings. |
Remarks
The code below illustrates how to create two recurring time regions.
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;
scheduler.TimeRegions.Add(timeRegion1);
//Region #2 - all day long, repeats every weekend
TimeRegion timeRegion2 = new TimeRegion();
timeRegion2.Start = baseDate;
timeRegion2.End = baseDate.AddDays(1);
timeRegion2.Editable = false;
timeRegion2.Recurrence = new RecurrenceInfo();
timeRegion2.Recurrence.Start = timeRegion2.Start;
timeRegion2.Recurrence.Type = RecurrenceType.Weekly;
timeRegion2.Recurrence.WeekDays = WeekDays.WeekendDays;
scheduler.TimeRegions.Add(timeRegion2);
You can add dates to the TimeRegion.ExceptionDates collection to remove individual time region occurences. For instance, the following code removes the timeRegion1 illustrated in the sample above from the March 21, 2019:
//Time must match the region's Start time
timeRegion1.ExceptionDates.Add(new DateTime(2019, 3, 21, 13, 0, 0));
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Recurrence property.
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.