Articles in this section
Category / Section

How to set non-working hours using SpecialTimeRegions in WPF Scheduler (Calendar)

1 min read

To set the non-working hours in a schedule view, use the SpecialTimeRegions property in the WPF Scheduler.

C#

In the Scheduler, add the non-working time collection to the SpecialTimeRegions property of the DaysViewSettings.

scheduler.DaysViewSettings.SpecialTimeRegions.Add(new SpecialTimeRegion
{
    StartTime = DateTime.MinValue.AddHours(0),
    EndTime = DateTime.MinValue.AddHours(9),
    RecurrenceRule = "FREQ=DAILY;INTERVAL=1"
});
 
scheduler.DaysViewSettings.SpecialTimeRegions.Add(new SpecialTimeRegion
{
    StartTime = DateTime.MinValue.AddHours(18),
    EndTime = DateTime.MinValue.AddHours(23),
    RecurrenceRule = "FREQ=DAILY;INTERVAL=1"
});

 

XAML

Set the Scheduler ViewType property as Day.

<Grid x:Name="grid">
    <syncfusion:SfScheduler x:Name="scheduler"
                            ViewType="Day"
                            >
    </syncfusion:SfScheduler>
</Grid>

View Sample in GitHub

Set the non-working hours in WPF Scheduler

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