Articles in this section
Category / Section

How to create recurring appointments in the WPF Schedule?

1 min read

Recurrence feature in the WPF Schedule 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.

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 given 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, recurrence rule is created for generating recurring appointments every 2 days. Now, you need to set the IsRecursive property of the Scheduleappointment to true and add the created appointment to the schedule’s Appointments property as given in the following code.

C#

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

 

The following screenshots display the output in different views.

C:\Users\sangavi\Documents\FFOutput\Screenshot (26)~1.jpg

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

C:\Users\sangavi\Documents\FFOutput\Screenshot (27)~1.jpg

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

C:\Users\sangavi\Documents\FFOutput\Screenshot (28)~1.jpg

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

 

C:\Users\sangavi\Documents\FFOutput\Screenshot (29)~1.jpg

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


Conclusion

I hope you enjoyed learning about how to create recurring appointments in the WPF Schedule.

You can refer to our WPF Schedule feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

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