Easily Create Repeating or Recurring Appointments Using WPF Scheduler
Tags: csharp, dotnet, wpf, desktop
Published: 2022-04-26 12:51:33

---
title: Easily Create Repeating or Recurring Appointments Using WPF Scheduler
published: true
date: 2022-04-26 11:55:23 UTC
tags: csharp, dotnet, wpf, desktop
canonical_url: https://www.syncfusion.com/blogs/post/easily-create-repeating-or-recurring-appointments-using-wpf-scheduler.aspx
cover_image: https://www.syncfusion.com/blogs/wp-content/uploads/2022/04/Easily-Create-Repeating-or-Recurring-Appointments-Using-WPF-Scheduler-672x372.png
---

The [WPF Scheduler](https://www.syncfusion.com/wpf-controls/scheduler "WPF Scheduler") is used to schedule day-to-day appointments, and it also makes it easy to maintain repeating appointments such as anniversaries, birthdays, or meetings that occur on different dates at the same time.

In this blog post, we’ll see how to easily create and manage repeating appointments using the WPF Scheduler control.

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

Let’s look at the different recurrence patterns!

## Recurrence pattern

The recurrence pattern rule contains the following details of the repeating appointment:

- **Recurrence Frequency** : Specifies the repeat type as daily, weekly, monthly, or yearly.
- **Recurrence Interval** : Specifies the time interval between the recurring appointments.
- **Recurrence End Range** : The recurrence end range is based on a specific end date or the number of occurrences.

### Daily recurring events

Create events that occur every day and at the same time.

**Examples:**

You can create daily recurring appointments with count, end date, or no end date details.

```csharp
//Daily recurrence pattern with count.
FREQ=DAILY;INTERVAL=1;COUNT=5

//Daily recurrence pattern with end date.
FREQ=DAILY;INTERVAL=1;UNTIL=20200725

//Daily recurrence pattern with no end date.
FREQ=DAILY;INTERVAL=2;
```

### Weekly recurring events

Create events that occur on certain days every week.

**Examples:**

You can create weekly recurring appointments by specifying the count or end date with days of the week.

```html
//Weekly recurrence pattern with count and day of week.
FREQ=WEEKLY;INTERVAL=2;BYDAY=WE;COUNT=20

//Weekly recurrence pattern with end date and day of week.
FREQ=WEEKLY;INTERVAL=1;BYDAY=TU,FR;UNTIL=20200811

//Weekly recurrence pattern with no end date.
FREQ=WEEKLY;INTERVAL=2;BYDAY=MO,WE;
```

### Monthly recurring events

Create recurring events that occur on a certain day of a month or a certain day of a week every month.

**Examples:**

```SQL
//Monthly recurrence pattern with count and month day.
FREQ=MONTHLY;BYMONTHDAY=3;INTERVAL=1;COUNT=10

//Monthly recurrence pattern with end date, day of week, and week position.
FREQ=MONTHLY;INTERVAL=1;BYDAY=MO;BYSETPOS=2;UNTIL=20200725

// Monthly recurrence pattern with no end date.
FREQ=MONTHLY;BYMONTHDAY=3;INTERVAL=2;
```

### Yearly recurring events

Create recurring events that occur on a certain day of the month or a certain day of a week in the month that repeat every year.

**Examples:**

```SQL
//Yearly recurrence pattern with month and month day and end date.
FREQ=YEARLY;BYMONTHDAY=15;BYMONTH=5;INTERVAL=1; UNTIL=20230618

//Yearly recurrence pattern with count, month and week day and week position. 
FREQ=YEARLY;BYDAY=TH;BYSETPOS=2;BYMONTH=6;INTERVAL=1;COUNT=10

//Yearly recurrence pattern with no end date.
FREQ=YEARLY;BYDAY=SU;BYSETPOS=3;BYMONTH=8;INTERVAL=2;
```

## How to create recurring appointments in WPF Scheduler

Follow these steps to create [repeating appointments in the WPF Scheduler](https://help.syncfusion.com/wpf/scheduler/appointments#adding-recurrence-appointment "Appointments in WPF Scheduler documentation"):

1. First, initialize the Syncfusion WPF Scheduler control.
```html
xmlns:scheduler="using:Syncfusion.UI.Xaml.Scheduler"

<syncfusion:SfScheduler x:Name="Schedule"
                          ViewType="Week"
                          ItemsSource="{Binding AppointmentCollection}"&gt;
</syncfusion:SfScheduler>
```
2. Then, create repeating [events](https://help.syncfusion.com/wpf/scheduler/appointments "Appointments in WPF Scheduler") with the [recurrence rule](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Scheduler.ScheduleAppointment.html#Syncfusion_UI_Xaml_Scheduler_ScheduleAppointment_RecurrenceRule "RecurrenceRule property of WPF Scheduler") and add them to the Scheduler’s [ItemsSource](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Scheduler.SfScheduler.html#Syncfusion_UI_Xaml_Scheduler_SfScheduler_ItemsSource "ItemsSource property of WPF Scheduler").
```csharp
// Creating an instance for the Scheduler appointment collection.
var appointmentCollection = new ScheduleAppointmentCollection();

//Adding schedule appointment in appointment collection
var scheduleAppointment = new ScheduleAppointment()
{
  Id = 1,
  StartTime = new DateTime(2022, 3, 20, 11, 0, 0),
  EndTime = new DateTime(2022, 3, 20, 12, 0, 0),
  Subject = "Occurs every alternate day",
  AppointmentBackground = Brushes.RoyalBlue,
  Foreground = Brushes.White,
};

//Creating the recurrence rule.
scheduleAppointment.RecurrenceRule = "FREQ=DAILY;INTERVAL=2;COUNT=10";

//Adding schedule appointment to the appointment collection.
appointmentCollection.Add(scheduleAppointment);

//Setting the appointment collection to the ItemsSource of the SfScheduler.
Schedule.ItemsSource = appointmentCollection;
```

![Daily Recurring Appointments in WPF Scheduler](https://www.syncfusion.com/blogs/wp-content/uploads/2022/04/Daily-Recurring-Appointments-in-WPF-Scheduler.png)
<figcaption>Daily Recurring Appointments in WPF Scheduler</figcaption>

**Note:** To learn more, refer to the [recurring appointments in the WPF Scheduler demo](https://github.com/SyncfusionExamples/WPF-Scheduler-Examples/tree/main/RecurringAppointment "Recurring appointments in the WPF Scheduler GitHub demo").

## Create recurrence exception appointment

It is also possible to remove or reschedule the event time of a specific occurrence of a recurring appointment.

For example, you can easily reschedule or delete an appointment from the series that occurs on a holiday.

To do so, we have to create recurrence exception appointments using the [RecurrenceExceptionDates](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Scheduler.ScheduleAppointment.html#Syncfusion_UI_Xaml_Scheduler_ScheduleAppointment_RecurrenceExceptionDates "RecurrenceExceptionDates property of WPF Scheduler") property in the [ScheduleAppointment](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Scheduler.ScheduleAppointment.html "Class ScheduleAppointment of WPF Scheduler") class.

Refer to the following code to remove the occurrence of any appointment on specific dates.

```csharp
// Creating an instance for appointment collection. 
var appointmentCollection = new ScheduleAppointmentCollection();   

// Recurrence and exception appointments.
var scheduleAppointment = new ScheduleAppointment 
{ 
  Id = 1, 
  Subject = "Daily scrum meeting",
  StartTime = new DateTime(2022, 3, 20, 11, 0, 0), 
  EndTime = new DateTime(2022, 3, 20, 12, 0, 0), 
  AppointmentBackground = new SolidColorBrush(Colors.RoyalBlue), 
  Foreground = new SolidColorBrush(Colors.White), 
  RecurrenceRule = "FREQ=DAILY;INTERVAL=1;COUNT=10" 
}; 

//Adding the recurring appointment to the appointmentcollection.
appointmentCollection.Add(scheduleAppointment);   

//Add the ExceptionDates to avoid occurrence on specific dates.
DateTime exceptionDate = scheduleAppointment.StartTime.AddDays(3).Date; scheduleAppointment.RecurrenceExceptionDates = new ObservableCollection&lt;DateTime&gt;() 
{ 
  exceptionDate, 
};   

//Setting appointmentCollection as ItemsSource of SfScheduler. 
Schedule.ItemsSource = appointmentCollection;
```

![Removing an Appointment with a Recurrence Exception in WPF Scheduler](https://www.syncfusion.com/blogs/wp-content/uploads/2022/04/Removing-an-Appointment-with-a-Recurrence-Exception-in-WPF-Scheduler2.png)
<figcaption>Removing an Appointment with a Recurrence Exception in WPF Scheduler</figcaption>

Refer to the following code to reschedule recurring appointments.

```csharp
// Creating an instance for appointment collection.
var appointmentCollection = new ScheduleAppointmentCollection();

// Recurrence and exception appointment.
var scheduleAppointment = new ScheduleAppointment
{
   Id = 1,
   Subject = "Daily scrum meeting",
   StartTime = new DateTime(2022, 3, 20, 11, 0, 0),
   EndTime = new DateTime(2022, 3, 20, 12, 0, 0),
   AppointmentBackground = new SolidColorBrush(Colors.RoyalBlue),
   Foreground = new SolidColorBrush(Colors.White),
   RecurrenceRule = "FREQ=DAILY;INTERVAL=1;COUNT=10"
};

//Adding the recurring appointment to the appointmentCollection.
appointmentCollection.Add(scheduleAppointment);

//Add ExceptionDates to avoid occurrence on specific dates.
DateTime changedExceptionDate = scheduleAppointment.StartTime.AddDays(3).Date;
scheduleAppointment.RecurrenceExceptionDates = new ObservableCollection&lt;DateTime&gt;()
{
   changedExceptionDate,
};

//Creating an exception occurrence appointment by changing the start time or end time. 

// RecurrenceId is set to 1, so it will change the 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(Colors.DeepPink),
  Foreground = new SolidColorBrush(Colors.White),
  RecurrenceId = 1
};

// Adding an exception occurrence appointment to the appointmentCollection.
appointmentCollection.Add(exceptionAppointment);

//Setting the appointmentCollection as a ItemsSource of SfScheduler.
Schedule.ItemsSource = appointmentCollection;
```

![Removing an Appointment with a Recurrence Exception in WPF Scheduler](https://www.syncfusion.com/blogs/wp-content/uploads/2022/04/Removing-an-Appointment-with-a-Recurrence-Exception-in-WPF-Scheduler.png)
<figcaption>Removing an Appointment with a Recurrence Exception in WPF Scheduler</figcaption>

**Note:** To learn more, refer to the [recursive exception appointments demo on GitHub](https://github.com/SyncfusionExamples/WPF-Scheduler-Examples/tree/main/RecurrsiveExceptionAppointment "Recursive exception appointments in WPF Scheduler GitHub demo").

## Recurrence editor

Also, you can easily edit or delete a single or series of recurring appointments using the recurrence editor in the WPF Scheduler.

The following window will appear when we double-click on any recurring appointment to edit it.

![Editing Recurring Appointments in WPF Scheduler](https://www.syncfusion.com/blogs/wp-content/uploads/2022/04/Editing-Recurring-Appointments-in-WPF-Scheduler.png)
<figcaption>Editing Recurring Appointments in WPF Scheduler</figcaption>

The following window will appear when we delete a recurring appointment using the **Delete** key.

![Deleting Recurring Appointments in WPF Scheduler](https://www.syncfusion.com/blogs/wp-content/uploads/2022/04/Deleting-Recurring-Appointments-in-WPF-Scheduler.png)
<figcaption>Deleting Recurring Appointments in WPF Scheduler</figcaption>

## Conclusion

Thanks for reading! In this blog, we have seen how to easily create, edit, reschedule, and delete recurring appointments using the [WPF Scheduler](https://www.syncfusion.com/wpf-controls/scheduler "WPF Scheduler"). Try out the steps provided in this blog post and enjoy hassle-free scheduling!

To find detailed explanations of each feature in the Scheduler control with code examples, refer to this [documentation](https://help.syncfusion.com/wpf/scheduler/overview "WPF Scheduler Overview").

Please feel free to share your feedback or ask questions in the comments section below. You can also contact us through our [support forum](https://www.syncfusion.com/forums "Syncfusion support forum"), [support portal](https://support.syncfusion.com/ "Syncfusion support portal"), or [feedback portal](https://www.syncfusion.com/feedback/home "Syncfusion Feedback Portal"). We are happy to assist you!

## Related blogs

- [Syncfusion Essential Studio 2022 Volume 1 is Here!](https://www.syncfusion.com/blogs/post/syncfusion-essential-studio-2022-volume-1-is-here.aspx "Blog: Syncfusion Essential Studio 2022 Volume 1 is Here!")
- [Display Alerts for Appointments in WPF Scheduler](https://www.syncfusion.com/blogs/post/how-to-display-alerts-for-appointments-in-wpf-scheduler.aspx "Blog: Display Alerts for Appointments in WPF Scheduler")
- [Load Appointments on Demand via Web Services in WPF Scheduler](https://www.syncfusion.com/blogs/post/load-appointments-on-demand-via-web-services-in-wpf-scheduler.aspx "Blog: Load Appointments on Demand via Web Services in WPF Scheduler")
- [Easily Allocate Resources with the Resource View in WPF Scheduler](https://www.syncfusion.com/blogs/post/easily-allocate-resources-with-the-resource-view-in-wpf-scheduler.aspx "Blog: Easily Allocate Resources with the Resource View in WPF Scheduler")