Version

Recurrent Activity (XamScheduler)

Purpose

This topic explains the repetitive behavior of the activities.

Required Background

Topic Purpose

This topic provides an overview of the XamScheduler control.

This topic explains how to bind the control to a data source using ScheduleListDataSource.

This topic explains the Appointment activity type.

Overview

The activity recurrence is used when you need to have repetitions of an activity following a specific recurrence pattern (for example each day at a specific hour or each month at a specific date).

You need to follow these steps in order to create a recurrent activity:

  1. Create an activity and set its subject, start and end time (this will be the recurrence root activity)

  2. Create DateRecurrence instance and configure its:

    1. Frequency (for example daily, weekly, monthly…​)

    2. Repetition Count or Until date (mutually exclusive)

  3. Obtain an iCalendar string representation of the recurrence by using the ToICalendarString method

    Note
    Note

    You can also use this website to create a recurrence rule in iCalendar format.

  4. Set the iCalendar recurrence string representation to the activity’s Recurrence property

  5. Add this activity to the AppointmentItemsSource collection property of the ScheduleListDataSource.

The above steps should create a number of activities following the recurrence patterns specified in the DateRecurrence object.

Note
Note

The recurrent activities created by the control are not available in the data source. They can only by obtained using the GetAppointmentsInRange method. The data source will only contains the root activity.

Main Properties

The following table lists the activity’s key properties related to the recurrence behavior and their purpose:

Property Purpose

This string property is used to get and set a recurrence pattern for the recurrence root activity.

This read only boolean property is used to determine if the activity in question is a recurrence root activity.

This read only ActivityBase type property is used to obtain the root recurrence activity or null if the activity is not associated with a recurrence.

This read only string property is used to obtain the ID of the root recurrence activity or null if the activity is not associated with a recurrence.

Code Example

The following code example demonstrates how to create a recurrent appointment with a weekly recurrence rule and 20 repetitions:

In C#:

DateTime today = DateTime.Now.Date;

Appointment appointment1 = new Appointment();
appointment1.Subject = "Basketball";
appointment1.Location = "Basketball court";
appointment1.Start = new DateTime(today.Year, today.Month, today.Day, 19, 30, 0);
appointment1.End = new DateTime(today.Year, today.Month, today.Day, 20, 30, 0);

DateRecurrence dr = new DateRecurrence();
dr.Frequency = DateRecurrenceFrequency.Weekly;
dr.Count = 20;

appointment1.Recurrence = dr.ToICalendarString();

Related Topics

Topic Purpose

This topic explains the Appointment activity type.

This topic provides information about the resources concept of the XamScheduler control.