Skip to main content

How to: Conditionally Show and Hide Time Regions

This example illustrates how to filter Time Regions that last less than a day in MonthView.

When you define a Time Region for an interval that is less than a day (several hours, minutes, etc.), the MonthView displays this region as if it takes the whole day. Handle the SchedulerControl.FilterTimeRegion event and set the event’s Visible property to false to hide time regions with a duration of less than 24 hours.

 private void scheduler_FilterTimeRegion(object sender, FilterTimeRegionEventArgs e) {
    e.Visible = e.TimeRegion.Interval.Duration.TotalHours > 23
        || !(e.View is MonthView);

You can use DXEvent to define the SchedulerControl.FilterTimeRegion event in XAML.

View Example

 <dxsch:SchedulerControl ...
       FilterTimeRegion="{DXEvent Handler='@args.Visible = @args.TimeRegion.Interval.Duration.TotalHours > 23 or !(@args.View is $dxsch:MonthView)'}">