Easily Schedule Recurring Events in WinUI Scheduler
Tags: csharp, dotnet, winui, desktop
Published: 2022-01-25 12:57:22

---
title: Easily Schedule Recurring Events in WinUI Scheduler
published: true
date: 2022-01-21 12:05:03 UTC
tags: csharp, dotnet, winui, desktop
canonical_url: https://www.syncfusion.com/blogs/post/easily-schedule-recurring-events-in-winui-scheduler.aspx
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pnvks2p5rvotgckawym1.png
---

In the Scheduler control, create events to schedule meetings and plan important tasks in your daily life. The scheduler control allows you to add appointments with details such as start and end times, subjects, and locations. You can also create recurring appointments.

A recurring or repeating appointment is a useful scheduling feature that allows you to create events that will appear at the same time on different dates. For example, a birthday event that will repeat every year on the same date.

In this blog post, we’ll look at how to use the [WinUI Scheduler](https://www.syncfusion.com/winui-controls/scheduler "WinUI Scheduler") control to create recurring appointments.

**Note:** If you are new to our WinUI Scheduler control, then please read the [Getting Started with WinUI Scheduler](https://help.syncfusion.com/winui/scheduler/getting-started "Getting Started with WinUI Scheduler documentation") documentation before proceeding.

Before getting started, let’s look at the different recurrence patterns.

## Recurrence patterns

The [recurrence pattern](https://help.syncfusion.com/winui/scheduler/appointments#recurrence-rule "Recurrence rule in WinUI Scheduler documentation") specifies how frequently an event occurs. The event may occur on a daily, weekly, monthly, or yearly basis.

The following sections explain the different recurrence rules to be applied to specify the recurrence pattern.

### Daily

The daily recurrence pattern is used to schedule daily repeated events, and occurrence repeated based on the interval.

**Relevant properties:**

- FREQ—Repeat type of recurring appointment.
- INTERVAL—Interval value of the recurring appointment.
- COUNT—Count of the recurring appointments in the recurrence series.
- UNTIL—End date of the recurring appointment series.

**Example**

- Repeats daily with count or end range.
```csharp
//Daily recurrence with count.
FREQ=DAILY;INTERVAL=1;COUNT=10
//Daily recurrence with end date.
FREQ=DAILY;INTERVAL=1;UNTIL=20200725
```

- Repeats these events every two days with no end date.
```csharp
FREQ=DAILY;INTERVAL=2;
```

### Weekly

The weekly recurrence pattern schedules weekly repeated events on the same days every week and the occurrence is repeated based on the interval.

**Relevant properties:**

- FREQ—Repeat type of recurring appointment.
- BYDAY—Day of the week of the recurring appointment.
- INTERVAL—Interval value of the recurring appointment.
- COUNT—Count of the recurring appointments in the recurrence series.
- UNTIL—End date of the recurring appointment series.

**Example**

- Repeats weekly with count or end range.
```csharp
//Weekly recurrence with count and day of week.
FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,WE;COUNT=10
//Weekly recurrence with end date and day of week.
FREQ=WEEKLY;INTERVAL=1;BYDAY=TU;UNTIL=20210725
```

- Repeats these events every two weeks once with no end date.
```csharp
FREQ=WEEKLY;INTERVAL=2;BYDAY=MO,WE;
```

### Monthly

The monthly recurrence pattern schedules monthly repeated events on the same day of the month or the same week of the month and the occurrence is repeated based on the interval.

**Relevant properties:**

- FREQ—Repeat type of recurring appointment.
- INTERVAL—Interval value of the recurring appointment.
- COUNT—Count of the recurring appointments in the recurrence series.
- UNTIL—End date of the recurring appointment series.
- BYMONTHDAY—Date of the month of the recurring appointment.
- BYSETPOS—Week of the month of the recurring appointment.

**Example**

- Repeats monthly with count or end range.
```csharp
//Monthly recurrence with count, month day.
FREQ=MONTHLY;BYMONTHDAY=3;INTERVAL=1;COUNT=10
//Monthly recurrence with end date, day of week and week position.
FREQ=MONTHLY;INTERVAL=1;BYDAY=MO;BYSETPOS=2;UNTIL=20200725
```

- Repeats these events once every two months with no end date.
```csharp
FREQ=MONTHLY;BYMONTHDAY=3;INTERVAL=2;
```

### Yearly

The yearly recurrence pattern schedules yearly repeated events on the same day of the year or the same week of the year and the occurrence is repeated based on the interval.

**Relevant properties:**

- FREQ—Repeat type of the recurring appointment.
- INTERVAL—Interval value of the recurring appointment.
- COUNT—Count of the recurring appointment in recurrence series.
- UNTIL—End date of the recurring appointment series.
- BYMONTHDAY—Date of month of the recurring appointment.
- BYDAY—Day of week of the recurring appointment.
- BYMONTH—Month of year of the recurring appointment.

**Example**

- Repeats yearly with count or end range.
```csharp
//Yearly recurrence with count, month and week day.
FREQ=YEARLY;BYDAY=SU;BYSETPOS=3;BYMONTH=8;INTERVAL=1;COUNT=10
//Yearly recurrence with end date, month, and month day. 
FREQ=YEARLY;BYMONTHDAY=16;BYMONTH=6;INTERVAL=1;UNTIL=20250725
```

- Repeats these events every two years once with no end date.
```csharp
FREQ=YEARLY;BYDAY=SU;BYSETPOS=3;BYMONTH=8;INTERVAL=2;
```

## Scheduling recurring appointments

Follow these steps to schedule recurring appointments:

1. Initialize the [Scheduler](https://help.syncfusion.com/winui/scheduler/getting-started "Getting Started with WinUI Scheduler documentation") control.
```html
xmlns:scheduler="using:Syncfusion.UI.Xaml.Scheduler"
<scheduler:SfScheduler x:Name="Schedule" 
                        ViewType="Week">
</scheduler:SfScheduler>
```
2. Use the [ScheduleAppointment](https://help.syncfusion.com/cr/winui/Syncfusion.UI.Xaml.Scheduler.ScheduleAppointment.html "ScheduleAppointment class in WinUI Scheduler") class to create events and add the events using the [ItemsSource](https://help.syncfusion.com/cr/winui/Syncfusion.UI.Xaml.Scheduler.SfScheduler.html#Syncfusion_UI_Xaml_Scheduler_SfScheduler_ItemsSource "ItemsSource property in WinUI Scheduler") property of **SfScheduler**. Use the [RecurrenceRule](https://help.syncfusion.com/cr/winui/Syncfusion.UI.Xaml.Scheduler.ScheduleAppointment.html#Syncfusion_UI_Xaml_Scheduler_ScheduleAppointment_RecurrenceRule "RecurrenceRule in WinUI Scheduler") property of [ScheduleAppointment](https://help.syncfusion.com/cr/winui/Syncfusion.UI.Xaml.Scheduler.ScheduleAppointment.html "ScheduleAppointment class in WinUI Scheduler") to schedule the recurring events.
```csharp
Schedule.DisplayDate = new DateTime(2021, 3, 28, 11, 0, 0);
// Creating an instance for schedule appointment collection.
var appointmentCollection = new ScheduleAppointmentCollection();
//Adding schedule appointment in the schedule appointment collection. 
var scheduleAppointment = new ScheduleAppointment
{
//Id to recurrence pattern appointment.
    Id = 1,
    Subject = "Daily scrum meeting",
    StartTime = new DateTime(2021, 3, 28, 11, 0, 0),
    EndTime = new DateTime(2021, 3, 28, 12, 0, 0),
    AppointmentBackground = new SolidColorBrush(Color.FromArgb(255, 0, 120, 215)),
    Foreground = new SolidColorBrush(Colors.White),
//Add recurrence rule to repeat the event.
    RecurrenceRule = "FREQ=DAILY;INTERVAL=1;COUNT=10"
};
//Adding the schedule appointment to the schedule appointment collection.
appointmentCollection.Add(scheduleAppointment);
//Adding the schedule appointment collection to the ItemsSource of SfScheduler.
Schedule.ItemsSource = appointmentCollection;
```

![Event Occurs Everyday](https://www.syncfusion.com/blogs/wp-content/uploads/2022/01/Event-Occurs-Everyday.png)
<figcaption>Event Occurs Everyday</figcaption>

To learn more, refer to the [recurring events in WinUI Scheduler demo](https://github.com/SyncfusionExamples/WinUI-Scheduler-Examples/tree/main/RecurringAppointment "Recurring Appointment in WinUI Scheduler demo on GitHub").

## Delete an appointment occurrence

The Scheduler control’s recurrence pattern exception feature allows you to remove a specific occurrence from a recurring appointment or change the details of any occurrence.

For example, you can delete any recurring appointment that falls on a holiday or modify any occurrence based on your availability on a specific day. The [RecurrenceExceptionDates](https://help.syncfusion.com/cr/winui/Syncfusion.UI.Xaml.Scheduler.ScheduleAppointment.html#Syncfusion_UI_Xaml_Scheduler_ScheduleAppointment_RecurrenceExceptionDates "RecurrenceExceptionDates property in WinUI Scheduler") property of [ScheduleAppointment](https://help.syncfusion.com/cr/winui/Syncfusion.UI.Xaml.Scheduler.ScheduleAppointment.html "ScheduleAppointment class in WinUI Scheduler") is used to remove a specific occurrence of a recurring event.

Refer to the following code example for more details.

```csharp
Schedule.DisplayDate = new DateTime(2021, 3, 28, 11, 0, 0);

// Creating an instance for schedule appointment collection.
var appointmentCollection = new ScheduleAppointmentCollection();
// Recurrence and exception appointment.
var scheduleAppointment = new ScheduleAppointment
{
    Id = 1,
    Subject = "Daily scrum meeting",
    StartTime = new DateTime(2021, 3, 28, 11, 0, 0),
    EndTime = new DateTime(2021, 3, 28, 12, 0, 0),
    AppointmentBackground = new SolidColorBrush(Color.FromArgb(255, 0, 120, 215)),
    Foreground = new SolidColorBrush(Colors.White),
    RecurrenceRule = "FREQ=DAILY;INTERVAL=1;COUNT=10"
};
//Adding the recurring or pattern appointment to the AppointmentCollection.
appointmentCollection.Add(scheduleAppointment);

//Add exception dates to avoid occurrence on specific dates.
DateTime changedExceptionDate = scheduleAppointment.StartTime.AddDays(3).Date;
scheduleAppointment.RecurrenceExceptionDates = new ObservableCollection<DateTime>()
{
    changedExceptionDate,
};

//Setting the AppointmentCollection as an ItemSource of SfScheduler.
this.Schedule.ItemsSource = appointmentCollection;
```

![A Specific Occurrence Deleted in a Recurring Event](https://www.syncfusion.com/blogs/wp-content/uploads/2022/01/A-Specific-Occurrence-Deleted-in-a-Recurring-Event.png)
<figcaption>A Specific Occurrence Deleted in a Recurring Event</figcaption>

## Recurrence exception appointment

You can modify any particular occurrence of a recurring appointment by using the [RecurrenceExceptionDates](https://help.syncfusion.com/cr/winui/Syncfusion.UI.Xaml.Scheduler.ScheduleAppointment.html#Syncfusion_UI_Xaml_Scheduler_ScheduleAppointment_RecurrenceExceptionDates "RecurrenceExceptionDates property in WinUI Scheduler") and [RecurrenceId](https://help.syncfusion.com/cr/winui/Syncfusion.UI.Xaml.Scheduler.ScheduleAppointment.html#Syncfusion_UI_Xaml_Scheduler_ScheduleAppointment_RecurrenceId "RecurrenceId property in WinUI Scheduler") properties of [ScheduleAppointment](https://help.syncfusion.com/cr/winui/Syncfusion.UI.Xaml.Scheduler.ScheduleAppointment.html "ScheduleAppointment class in WinUI Scheduler").

Refer to the following code example for more details.

```csharp
Schedule.DisplayDate = new DateTime(2021, 3, 28, 11, 0, 0);

// Creating an instance for schedule appointment collection.
Var appointmentCollection = new ScheduleAppointmentCollection();
// Recurrence and exception appointment.
Var scheduleAppointment = new ScheduleAppointment
{
    Id = 1,
    Subject = “Daily scrum meeting”,
    StartTime = new DateTime(2021, 3, 28, 11, 0, 0),
    EndTime = new DateTime(2021, 3, 28, 12, 0, 0),
    AppointmentBackground = new SolidColorBrush(Color.FromArgb(255, 0, 120, 215)),
    Foreground = new SolidColorBrush(Colors.White),
    RecurrenceRule = “FREQ=DAILY;INTERVAL=1;COUNT=10”
};
//Adding the recurring or pattern appointment to the AppointmentCollection.
appointmentCollection.Add(scheduleAppointment);

//Add exception dates to avoid occurrence on specific dates.
DateTime changedExceptionDate = scheduleAppointment.StartTime.AddDays(3).Date;
scheduleAppointment.RecurrenceExceptionDates = new ObservableCollection<DateTime>()
{
    changedExceptionDate,
};

//Creating an exception occurrence appointment by changing the start time or end time. 
// RecurrenceId is set to 1(parent recurrence Id value), so it will be the changed occurrence for the above-created pattern appointment. 
Var exceptionAppointment = new ScheduleAppointment()
{
    Id = 2,
    Subject = “Scrum meeting – Changed Occurrence”,
    StartTime = new DateTime(changedExceptionDate.Year, changedExceptionDate.Month, changedExceptionDate.Day, 13, 0, 0),
    EndTime = new DateTime(changedExceptionDate.Year, changedExceptionDate.Month, changedExceptionDate.Day, 14, 0, 0),
    AppointmentBackground = new SolidColorBrush(Color.FromArgb(255, 112, 173, 71)),
    Foreground = new SolidColorBrush(Colors.White),
    RecurrenceId = 1
};
// Adding an exception occurrence appointment to the AppointmentCollection.
appointmentCollection.Add(exceptionAppointment);
//Setting the AppointmentCollection as a ItemSource of SfScheduler.
This.Schedule.ItemsSource = appointmentCollection;
```

To learn more, refer to the [recursive appointment exception demo](https://github.com/SyncfusionExamples/WinUI-Scheduler-Examples/tree/main/RecursiveExceptionAppointment "Recursive Exception Appointment in WinUI Scheduler demo on GitHub").

![Exception Occurrence Appointment in WinUI Scheduler](https://www.syncfusion.com/blogs/wp-content/uploads/2022/01/Exception-Occurrence-Appointment-in-WinUI-Scheduler.png)
<figcaption>Exception Occurrence Appointment in WinUI Scheduler</figcaption>

## Recurrence editor

Rather than creating multiple appointments for the same time on different dates, you can use Scheduler control’s recurring appointment editor to make a single appointment recurring.

Double-click on an appointment to open the following editor.

![Daily Recurrence in WinUI Scheduler](https://www.syncfusion.com/blogs/wp-content/uploads/2022/01/Daily-Recurrence-in-WinUI-Scheduler.png)
<figcaption>Daily Recurrence in WinUI Scheduler</figcaption>

![Weekly Recurrence in WinUI Scheduler](https://www.syncfusion.com/blogs/wp-content/uploads/2022/01/Weekly-Recurrence-in-WinUI-Scheduler.png)
<figcaption>Weekly Recurrence in WinUI Scheduler</figcaption>

![Monthly Recurrence by Day in WinUI Scheduler](https://www.syncfusion.com/blogs/wp-content/uploads/2022/01/Monthly-Recurrence-by-Day-in-WinUI-Scheduler.png)
<figcaption>Monthly Recurrence by Day in WinUI Scheduler</figcaption>

![Monthly Recurrence by Week in WinUI Scheduler](https://www.syncfusion.com/blogs/wp-content/uploads/2022/01/Monthly-Recurrence-by-Week-in-WinUI-Scheduler.png)
<figcaption>Monthly Recurrence by Week in WinUI Scheduler</figcaption>

![Yearly Recurrence by Month Day in WinUI Scheduler](https://www.syncfusion.com/blogs/wp-content/uploads/2022/01/Yearly-Recurrence-by-Month-Day-in-WinUI-Scheduler.png)
<figcaption>Yearly Recurrence by Month Day in WinUI Scheduler</figcaption>

![Yearly Recurrence by Week in WinUI Scheduler](https://www.syncfusion.com/blogs/wp-content/uploads/2022/01/Yearly-Recurrence-by-Week-in-WinUI-Scheduler.png)
<figcaption>Yearly Recurrence by Week in WinUI Scheduler</figcaption>

A single or series of recurring appointments can also be modified using the recurrence editor in WinUI Scheduler.

![Edit Recurring Appointment in WinUI Scheduler](https://www.syncfusion.com/blogs/wp-content/uploads/2022/01/Edit-Recurring-Appointment-in-WinUI-Scheduler.png)
<figcaption>Edit Recurring Appointments in WinUI Scheduler</figcaption>

![Delete Recurring Appointment in WinUI Scheduler](https://www.syncfusion.com/blogs/wp-content/uploads/2022/01/Delete-Recurring-Appointment-in-WinUI-Scheduler.png)
<figcaption>Delete Recurring Appointments in WinUI Scheduler</figcaption>

## Conclusion

In this blog post, we had a quick overview of scheduling recurring appointments in the [WinUI Scheduler](https://www.syncfusion.com/winui-controls/scheduler "WinUI Scheduler control"). You can explore other features in the Scheduler control through our [documentation](https://help.syncfusion.com/winui/scheduler/overview "WinUI Scheduler documentation"), where you can find detailed explanations of each feature with code examples.

Please feel free to try out the samples available in the [GitHub location](https://github.com/SyncfusionExamples/WinUI-Scheduler-Examples "WinUI Scheduler demos on GitHub") and share your feedback or ask questions in the comments section. You can also contact us through our [support forums](https://www.syncfusion.com/forums "Syncfusion support forum"), [support tickets](https://support.syncfusion.com/ "Syncfusion support portal"), or [feedback portal](https://www.syncfusion.com/feedback/winui "Syncfusion Feedback Portal"). As always, we are happy to assist you!

## Related blogs

- [Top 10 Features of WinUI 3 DataGrid Control for Efficient Data Handling](https://www.syncfusion.com/blogs/post/top-10-features-of-winui-3-datagrid-control-for-efficient-data-handling.aspx "Top 10 Features of WinUI 3 DataGrid Control for Efficient Data Handling blog")
- [What’s New in 2021 Volume 4: WinUI and WPF](https://www.syncfusion.com/blogs/post/whats-new-in-2021-volume-4-winui-and-wpf.aspx "What’s New in 2021 Volume 4: WinUI and WPF blog")
- [Introducing the New WinUI 3 AutoComplete Control](https://www.syncfusion.com/blogs/post/introducing-the-new-winui-3-autocomplete-control.aspx "Introducing the New WinUI 3 AutoComplete Control blog")
- [WinUI Scheduler: A Smart Tool to Handle Appointments in a Hospital](https://www.syncfusion.com/blogs/post/winui-scheduler-a-smart-tool-to-handle-appointments-in-a-hospital.aspx "WinUI Scheduler: A Smart Tool to Handle Appointments in a Hospital blog")