Articles in this section
Category / Section

How to create Recurring Appointments in WinRT Schedule?

1 min read

Recurrence feature in the SfSchedule control is used to create recurring appointments. This article explains how to create recurring appointments with a time interval of two days.

Creating Recurring Appointments

  1. Create an appointment by using the following code example.

XAML

<Grid Background="White">
<syncfusion:SfSchedule ScheduleType="TimeLine"
Name="schedule"    Resource="Doctors" >
<Grid Background="White">

C#

ScheduleAppointment appointment = new ScheduleAppointment();
appointment.Subject = "Team Meeting";
appointment.Notes = "Daily Recurrence";
appointment.Location = "Meeting Hall 1";
appointment.StartTime = DateTime.Now.SubractDays(11);
appointment.EndTime = DateTime.Now.SubractDays(11).AddHours(4);
appointment.AppointmentBackground = new SolidColorBrush(                        (Color.FromArgb(0xFF, 0xD8, 0x00, 0x73)));
  1. Now, generate Recurrence rule by using RRuleGenerator and assign it to the RecurrenceRule property of the above created appointment as illustrated in the following code example.

Note: The RRuleGenerator method is used to create Rule available in the ScheduleHelper class.

C#

RecurrenceProperties RecProp = new RecurrenceProperties()
//Specifying Recurrence type.
RecProp.RecurrenceType = RecurrenceType.Daily;
//Enabling EveryNDays
RecProp.IsDailyEveryNDays = true;
//Specifying the interval of 2 days
RecProp.DailyNDays = 2;
//Enabling the Range count specification
RecProp.IsRangeRecurrenceCount = true;
//Disabling the No end date
RecProp.IsRangeNoEndDate = false;
//Disabling the end date
RecProp.IsRangeEndDate = false;
//Specifying the range count
RecProp.RangeRecurrenceCount = 100;
appointment.RecurrenceRule = ScheduleHelper.RRuleGenerator(RecProp,
appointment.StartTime, appointment.EndTime);
  1. In the above code example, recurrence rule is created for generating recurring appointments every 2 days. Now, set the IsRecursive property of the Scheduleappointment to true and add the created appointment to the schedule’s Appointments property as illustrated in the following code example.

C#

app.IsRecursive = true;
schedule.Appointments.Add(app);

The following screenshots display the output in different views.

C:\Users\ApoorvahR\Desktop\1.jpg

Figure 1: Recurring appointments with time intervals of two days in the Month View

C:\Users\ApoorvahR\Desktop\2.jpg

Figure 2: Recurring appointments with time intervals of two days in the Week view

C:\Users\ApoorvahR\Desktop\3.jpg

Figure 3: Recurring appointments with time intervals of two days in the Day view

C:\Users\ApoorvahR\Desktop\4.jpg

Figure 4: Recurring appointments with time intervals of two days in the TimeLine view

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied