Easily Create Repeating or Recurring Appointments Using WPF Scheduler
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (175).NET Core  (29).NET MAUI  (208)Angular  (109)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (41)Black Friday Deal  (1)Blazor  (220)BoldSign  (14)DocIO  (24)Essential JS 2  (107)Essential Studio  (200)File Formats  (66)Flutter  (133)JavaScript  (221)Microsoft  (119)PDF  (81)Python  (1)React  (101)Streamlit  (1)Succinctly series  (131)Syncfusion  (919)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (51)Windows Forms  (61)WinUI  (68)WPF  (159)Xamarin  (161)XlsIO  (36)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (8)Business intelligence  (55)Button  (4)C#  (150)Chart  (132)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (63)Development  (633)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (40)Extensions  (22)File Manager  (7)Gantt  (18)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (508)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (43)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (52)Security  (3)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (11)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (387)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (597)What's new  (333)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Easily Create Repeating or Recurring Appointments Using WPF Scheduler

Easily Create Repeating or Recurring Appointments Using WPF Scheduler

The 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 before proceeding.

Let’s look at the different recurrence patterns!

Recurrence pattern

The recurrence pattern rule contains the following details which are used to create the repeating or recurring 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 recurrence pattern

The daily recurrence pattern is used to create events that occur every day and at the same time.

Examples:

//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 pattern

The weekly recurrence pattern is used to create events that occur on certain days on every week.

Examples:

//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 pattern

The monthly recurrence pattern is used to create recurring events that occur on a certain day of a month or a certain day of a week every month.

Examples:

//Monthly recurrence pattern with count and day of the month.
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 pattern

The yearly recurrence pattern is used to 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:

//Yearly recurrence pattern with month, day of the month, 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:

  1. First, initialize the Syncfusion WPF Scheduler control.
    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 with the recurrence rule and add them to the Scheduler’s ItemsSource.
    // 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
    Daily Recurring Appointments in WPF Scheduler

Note: To learn more, refer to the recurring appointments in the WPF Scheduler 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 property in the ScheduleAppointment class.

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

// 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
Removing an Appointment with a Recurrence Exception in WPF Scheduler

Refer to the following code to reschedule recurring appointments.

// 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
Removing an Appointment with a Recurrence Exception in WPF Scheduler

Note: To learn more, refer to the recursive exception appointments demo on GitHub.

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
Editing Recurring Appointments in WPF Scheduler

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

Deleting Recurring Appointments in WPF Scheduler
Deleting Recurring Appointments in WPF Scheduler

Conclusion

Thanks for reading! In this blog, we have seen how to easily create, edit, reschedule, and delete recurring appointments using the 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.

Please feel free to share your feedback or ask questions in the comments section below. You can also contact us through our support forumsupport portal, or feedback portal. We are happy to assist you!

Related blogs

Tags:

Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed