Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (157).NET Core  (28).NET MAUI  (29)Angular  (64)ASP.NET  (48)ASP.NET Core  (72)ASP.NET MVC  (88)Azure  (31)Blazor  (130)DocIO  (22)Essential JS 2  (76)Essential Studio  (168)File Formats  (25)Flutter  (121)JavaScript  (165)Microsoft  (107)PDF  (64)React  (45)Succinctly series  (126)Syncfusion  (534)TypeScript  (30)Uno Platform  (3)UWP  (4)Vue  (34)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#  (115)Chart  (55)Cloud  (11)Company  (445)Dashboard  (6)Data Science  (3)Data Validation  (5)DataGrid  (53)Development  (322)Doc  (7)DockingManager  (1)eBook  (95)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (22)Extensions  (17)File Manager  (4)Gantt  (9)Gauge  (9)Git  (4)Grid  (27)HTML  (9)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (268)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  (183)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (1)Visual Studio  (23)Visual Studio Code  (14)Web  (292)What's new  (177)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 Schedule Recurring Events in WinUI Scheduler

Easily Schedule Recurring Events in WinUI Scheduler

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 control to create recurring appointments.

Note: If you are new to our WinUI Scheduler control, then please read the Getting Started with WinUI Scheduler documentation before proceeding.

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

Recurrence patterns

The recurrence pattern 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.
    //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.
    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.
    //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.
    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.
    //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.
    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.
    //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.
    FREQ=YEARLY;BYDAY=SU;BYSETPOS=3;BYMONTH=8;INTERVAL=2;

Scheduling recurring appointments

Follow these steps to schedule recurring appointments:

  1. Initialize the Scheduler control.
    xmlns:scheduler="using:Syncfusion.UI.Xaml.Scheduler"
    <scheduler:SfScheduler x:Name="Schedule" 
                            ViewType="Week">
    </scheduler:SfScheduler>
  2. Use the ScheduleAppointment class to create events and add the events using the ItemsSource property of SfScheduler. Use the RecurrenceRule property of ScheduleAppointment to schedule the recurring events.
    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
Event Occurs Everyday

To learn more, refer to the recurring events in WinUI Scheduler demo.

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 property of ScheduleAppointment is used to remove a specific occurrence of a recurring event.

Refer to the following code example for more details.

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
A Specific Occurrence Deleted in a Recurring Event

Recurrence exception appointment

You can modify any particular occurrence of a recurring appointment by using the RecurrenceExceptionDates and RecurrenceId properties of ScheduleAppointment.

Refer to the following code example for more details.

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.

Exception Occurrence Appointment in WinUI Scheduler
Exception Occurrence Appointment in WinUI Scheduler

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
Daily Recurrence in WinUI Scheduler
Weekly Recurrence in WinUI Scheduler
Weekly Recurrence in WinUI Scheduler
Monthly Recurrence by Day in WinUI Scheduler
Monthly Recurrence by Day in WinUI Scheduler
Monthly Recurrence by Week in WinUI Scheduler
Monthly Recurrence by Week in WinUI Scheduler
Yearly Recurrence by Month Day in WinUI Scheduler
Yearly Recurrence by Month Day in WinUI Scheduler
Yearly Recurrence by Week in WinUI Scheduler
Yearly Recurrence by Week in WinUI Scheduler

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

Edit Recurring Appointment in WinUI Scheduler
Edit Recurring Appointments in WinUI Scheduler
Delete Recurring Appointment in WinUI Scheduler
Delete Recurring Appointments in WinUI Scheduler

Conclusion

In this blog post, we had a quick overview of scheduling recurring appointments in the WinUI Scheduler. You can explore other features in the Scheduler control through our 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 and share your feedback or ask questions in the comments section. You can also contact us through our support forumssupport tickets, or feedback portal. As always, 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