- 2 minutes to read
The DevExpress Scheduler control allows you to create recurring appointments.
How to Create Recurrences
The pattern appointment defines the schedule and time frame of a recurring series.
To create a recurring series in code, set the AppointmentItem.Type property to Pattern and use the AppointmentItem.RecurrenceInfo property to define the recurrence pattern. The scheduler automatically generates occurrences based on the pattern.
The RecurrenceBuilder class simplifies the task of creating recurrence patterns. The table below lists the available recurrence builders:
End-users can edit an appointment’s recurrence pattern at runtime using the Recurrence Window.
Occurrences and Exceptions
The Pattern appointment defines a recurring series, and Occurrence appointments are generated automatically according to the pattern. If you modify an occurrence (for example, postpone it for an hour), its type changes to ChangedOccurrence. If you delete an occurrence, it becomes a DeletedOccurrence.
If you modify the pattern, the Scheduler removes all changed and deleted occurrences and repopulates the series with regular occurrences.
How to Access Occurrences and Exceptions
The Pattern, ChangedOccurrence, and DeletedOccurrence appointments are stored in the SchedulerControl.AppointmentItems collection. The Occurrence appointments are not stored in any collection to avoid a stack overflow for infinite recurring series. These appointments are automatically generated at runtime based on the pattern’s AppointmentItem.RecurrenceInfo.
A recurring appointment’s AppointmentItem.RecurrencePattern property returns the pattern.
Use the pattern’s AppointmentItem.GetExceptions method to access the exceptions collection. This collection contains AppointmentType.ChangedOccurrence and AppointmentType.DeletedOccurrence appointment types. Exceptions replace regular occurrences - the Occurrence appointment with the same SchedulerItemBase.RecurrenceIndex is not generated for each appointment in the exception’s collection.
Use the AppointmentItem.RestoreOccurrence method to restore the original occurrence from an exception.