This is a migrated thread and some comments may be shown as answers.

Occur every hour daily within timeframe

1 Answer 36 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
heavywoody
Top achievements
Rank 1
heavywoody asked on 06 Mar 2017, 04:16 PM

Is it possible to set a Reccurrence Rule so that an appointment could happen every hour for days, but only between like 10am-4pm?   I can easily create an hourly pattern that lasts for days, but don't know how to make it only happen between a certain range in a day.

 

Thanks!

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 09 Mar 2017, 11:53 AM
Hello Christian,

To achieve the desired behavior you should create an appointment with an hour, duration a RecurrencePattern with a RecurrenceFrequency equal to hourly and HoursOfDay equal to the hours you want. For reference please take a look at the code snippet below:
private ObservableCollection<Appointment> CreateAppointments()
{
    ObservableCollection<Appointment> apps = new ObservableCollection<Appointment>();
 
    var app1 = new Appointment()
    {
        Subject = "Front-End Meeting",
        Start = DateTime.Today,
        End = DateTime.Today.AddHours(1)
    };
 
    var pattern = new RecurrencePattern()
    {
        Frequency = RecurrenceFrequency.Hourly,
        HoursOfDay = new int[] { 10, 11, 12, 13, 14, 15, 16 },
        MaxOccurrences = 35
    };
    app1.RecurrenceRule = new RecurrenceRule(pattern);
    apps.Add(app1);
 
 
    return apps;
}

I hope that this helps.

Regards,
Martin Vatev
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
Tags
ScheduleView
Asked by
heavywoody
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or