Articles in this section
Category / Section

How to create yearly recurrence appointments in WPF Scheduler (Calendar)

1 min read

Add the yearly 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 Yearly on June 16th",
        };
        scheduleAppointment.RecurrenceRule ="FREQ=YEARLY;BYMONTHDAY=16;BYMONTH=6;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="Month"
                        ItemsSource="{Binding ScheduleAppointmentCollection}">
    <syncfusion:SfScheduler.AppointmentMapping>
        <syncfusion:AppointmentMapping StartTime="From"
                                        EndTime="To"
                                        Subject="EventName"
                                    />
    </syncfusion:SfScheduler.AppointmentMapping>
</syncfusion:SfScheduler>

View Sample in GitHub

A screenshot of a computer

Description automatically generated with low confidence

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