Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (156).NET Core  (27).NET MAUI  (26)Angular  (64)ASP.NET  (48)ASP.NET Core  (71)ASP.NET MVC  (88)Azure  (30)Blazor  (128)DocIO  (22)Essential JS 2  (76)Essential Studio  (168)File Formats  (24)Flutter  (121)JavaScript  (165)Microsoft  (107)PDF  (63)React  (42)Succinctly series  (126)Syncfusion  (530)TypeScript  (30)Uno Platform  (3)UWP  (4)Vue  (33)Webinar  (29)Windows Forms  (57)WinUI  (38)WPF  (131)Xamarin  (142)XlsIO  (25)Other CategoriesBarcode  (5)BI  (29)Bold BI  (4)Build conference  (6)Business intelligence  (53)Button  (4)C#  (114)Chart  (55)Cloud  (10)Company  (445)Dashboard  (6)Data Science  (3)Data Validation  (5)DataGrid  (53)Development  (317)Doc  (7)DockingManager  (1)eBook  (95)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (22)Extensions  (17)File Manager  (4)Gantt  (9)Gauge  (8)Git  (4)Grid  (27)HTML  (9)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (267)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (28)Performance  (8)PHP  (1)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (7)Road Map  (10)Scheduler  (33)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (20)Solution Services  (2)Spreadsheet  (11)SQL  (8)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (11)Tips and Tricks  (87)UI  (181)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (1)Visual Studio  (23)Visual Studio Code  (14)Web  (287)What's new  (175)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Share on twitter
Share on facebook
Share on linkedin
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:

Share on twitter
Share on facebook
Share on linkedin
Popular Now

Be the first to get updates

Subscribe RSS feed
Scroll To Top