In this blog post, we demonstrate how to create and add repeating appointments to the VIBlend Silverlight Scheduler.
To create a repeating appointment in VIBlend Silverlight Scheduler, you can follow these steps:
- Double-Click on any scheduler cell or right-click to open the built-in context menu and click ‘New Appointment’.
- In the pop-up window that appears, click the Repeat... checkbox.
- Choose your desired settings in the Recurrence Dialog and click ‘Ok’.
- Fill in the appointment's other details.
- Click Save and Close to confirm the changes.
To make an existing appointment repeat, follow these steps:
- Double-Click on the appointment and in the pop-up window that appears, click the Repeat... checkbox.
- Choose your desired settings in the Recurrence Dialog and click ‘Ok’.
- Fill in the appointment’s other details.
- Click Save and Close to confirm the changes.
To create a repeating appointment in the code-behind, follow these steps:
- Create a new Appointment object. Set the appointment’s start, duration, subject, description and location fields.
C#
DateTime appointmentStart = DateTime.Now.Date;
TimeSpan appointmentDuration = new TimeSpan(1, 0, 0);
Appointment lunchBreak = new Appointment(appointmentStart, appointmentDuration, "Lunch Break", "Steamed fillet of trout, served with sour-cream sauce, cucumber salad and boiled potatoes", "Lunch Room 1");
VB .NET
Dim appointmentStart As DateTime = DateTime.Now.Date
Dim appointmentDuration As New TimeSpan(1, 0, 0)
Dim lunchBreak As New Appointment(appointmentStart, appointmentDuration, "Lunch Break", "Steamed fillet of trout, served with sour-cream sauce, cucumber salad and boiled potatoes", "Lunch Room 1")
- Set the Appointment’s RecurrencePattern property to make it repeat. You can set this property to any class derived from the RecurrencePattern class. VIBlend Scheduler control provides four built-in recurrence patterns represented by the DayRecurrencePattern, MonthRecurrencePattern, YearRecurrencePattern and WeekRecurrencePattern classes. The following code snippet demonstrates how to specify a daily repeating behavior:
C#
lunchBreak.RecurrencePattern = new DayRecurrencePattern(lunchBreak.From, this.viblendScheduler.View.To, 1);
VB .NET
lunchBreak.RecurrencePattern = New DayRecurrencePattern(lunchBreak.From, Me.viblendScheduler.View.To, 1)
In the daily recurrence pattern, you need to specify the RepeatIndex property which determines the days between two occurences. The default property value is 1.
- Finally, add the appointment to the Scheduler.
C#
this.viblendScheduler.Appointments.Add(lunchBreak);
VB .NET
Me.viblendScheduler.Appointments.Add(lunchBreak)
CodeProject