Recurrences

  • 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:

Recurrence Builder Example
MinutelyRecurrenceBuilder How to: Create Minutely Recurrence
HourlyRecurrenceBuilder How to: Create Hourly Recurrence
DailyRecurrenceBuilder How to: Create Daily Recurrence
WeeklyRecurrenceBuilder How to: Create Weekly Recurrence
MonthlyRecurrenceBuilder How to: Create Monthly Recurrence
YearlyRecurrenceBuilder How to: Create Yearly Recurrence

End-users can edit an appointment's recurrence pattern at runtime using the Recurrence Window.

RecurrenceWindow

See also: How to: Create Regular and Recurrent Appointments at the View Model Level

Occurrences and Exceptions

Use the AppointmentItem.Type property to determine an appointment's type. To determine whether an appointment is recurring, use the AppointmentItem.IsRecurring property.

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.

WPF Scheduler_Recurring_Appointments_and_Exceptions

NOTE

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.