Category / Section
How to set non-working hours using SpecialTimeRegions in WPF Scheduler (Calendar)
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>
