Category / Section
How to create daily recurrence appointments in WPF Scheduler (Calendar)
1 min read
Add the daily recurrence appointment to the SfScheduler with the help of RecurrenceRule.
Please refer to the user guide documentation for the recurrence property and its purpose.
C#
Create the recurrence appointment in the ViewModel with the help of RecurrenceRule.
public class SchedulerViewModel : INotifyPropertyChanged { private ScheduleAppointmentCollection scheduleAppointmentCollection; public SchedulerViewModel() { this.ScheduleAppointmentCollection = new ScheduleAppointmentCollection(); var scheduleAppointment = new ScheduleAppointment() { Id = 1, StartTime = DateTime.Today.AddHours(11), EndTime = DateTime.Today.AddHours(12), Subject = "Occurs daily", }; scheduleAppointment.RecurrenceRule = "FREQ=DAILY;INTERVAL=1;COUNT=10"; ScheduleAppointmentCollection.Add(scheduleAppointment); } public ScheduleAppointmentCollection ScheduleAppointmentCollection { get { return this.scheduleAppointmentCollection; } set { this.scheduleAppointmentCollection = value; this.RaiseOnPropertyChanged("ScheduleAppointmentCollection"); } } public event PropertyChangedEventHandler PropertyChanged; private void RaiseOnPropertyChanged(string propertyName) { this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } }
XAML
Binding ScheduleAppointmentCollection to Scheduler.
<syncfusion:SfScheduler x:Name="Schedule" FirstDayOfWeek="Monday" ViewType="Week" ItemsSource="{Binding ScheduleAppointmentCollection}"> <syncfusion:SfScheduler.AppointmentMapping> <syncfusion:AppointmentMapping StartTime="From" EndTime="To" Subject="EventName" /> </syncfusion:SfScheduler.AppointmentMapping> </syncfusion:SfScheduler>