Overview
RadCalendar provides the functionality to configure repeating appointments. The user has the ability to apply recurring scheduling patterns such as daily, weekly, monthly or set a range of recurrence from date to date. The flexible rule mechanism covers the most common recurrence scenarios. Furthermore, you also have the option to handle the exceptions from this rule.
The purpose of this overview is to give you a straight-forward way how to create and apply a recurrence pattern, rule and exception. If you want to dive deeper into the recurrence feature of the RadCalendar, check out the following topics:
The Recurrence is part of Telerik UI for Xamarin, a
professional grade UI component library for building modern and feature-rich applications. To try it out sign up for a free 30-day trial.
RadCalendar includes support for recurring events on daily, weekly, monthly and yearly basis. Exceptions to the recurrence rules are also permitted. To support this recurrence behavior, the Telerik.XamarinForms.Input.Appointment class includes the RecurrenceRule property. When an appointment is promoted into a recurring event its RecurrenceRule is set with correct RecurrencePattern.
If the user modifies an individual appointment occurrence, an exception is created. This exception is added to the RecurrenceRule of the master appointment along with its specific date.
Consider the following example:
- Create a sample appointment that starts at 11:00 AM and lasts half an hour:
var date = DateTime.Today;
var appointment = new Appointment()
{
Title = "Daily appointment",
StartDate = date.AddHours(11),
EndDate = date.AddHours(11).AddMinutes(30),
Color = Color.Tomato
};
- Create a daily recurrence pattern, that specifies a limit of 5 occurrences for the appointment:
var pattern = new RecurrencePattern()
{
Frequency = RecurrenceFrequency.Daily,
DaysOfWeekMask = RecurrenceDays.EveryDay,
MaxOccurrences = 5
};
- Set the recurrence rule to appointment:
appointment.RecurrenceRule = new RecurrenceRule(pattern);
- Add exception date to the recurrence rule:
appointment.RecurrenceRule.Exceptions.Add(new ExceptionOccurrence() { ExceptionDate = date.AddDays(1) });
- Create an exception appointment:
var exceptionAppointment = new Appointment()
{
Title = appointment.Title,
StartDate = appointment.StartDate.AddDays(3).AddHours(1),
EndDate = appointment.EndDate.AddDays(3).AddHours(1),
Color = appointment.Color
};
appointment.RecurrenceRule.Exceptions.Add(new ExceptionOccurrence() {
ExceptionDate = date.AddDays(3),
Appointment = exceptionAppointment
});
Finally when you add the created appointment to the AppointmentsSource of RadCalendar, you'll get the following generated appointments: