WPF Scheduler Control - Time Region Support

WPF Team Blog
26 November 2019

Our most recent update (v19.2) adds Time Region support to our WPF Scheduler control. This feature allows you to highlight time intervals.

To highlight a time interval, create a TimeRegionItem and specify the interval and the brush you wish to apply to time cells. You can also specify associated resources. If the Scheduler is grouped, Time Regions are only displayed for resources to which they apply.

As you may know, we ship a set of predefined brushes specifically designed for Time Regions (within the DefaultBrushNames class). Since these brushes are theme-dependent, you don’t have to worry about theme-specific customization. You can also use our streamlined Scheduler style mechanism to define your own brush set.

In the image below, we use Time Regions to highlight weekends and lunch times. As you can see, the highlight pattern changes colors depending on the theme used.

Time Regions

Time Regions are fully integrated with our DataSource class. This class provides TimeRegionsSource and TimeRegionMappings properties so you can leverage Time Regions when in bound mode.

To help you render recurring Time Regions in an efficient manner, v19.2 ships with a new RecurrenceBuilder class. This new class allows you create recurrence patterns using the Fluent API style – both in XAML and code-behind. The following XAML snippet illustrates how to create a Time Region that highlights repeating lunch times.

<dxsch:SchedulerControl> 
    <!--define a custom template that adds an icon to time regions--> 
    <dxsch:SchedulerControl.Resources> 
        <DataTemplate x:Key="lunchRegionTemplate"> 
            <Image MaxHeight="28" Source="{dx:DXImage ImagePath='SvgImages/Icon Builder/Travel_Restaurant.svg'}" /> 
        </DataTemplate> 
    </dxsch:SchedulerControl.Resources> 
    <!--apply the template--> 
    <dxsch:DayView TimeRegionContentTemplate="{StaticResource lunchRegionTemplate}" /> 
    <!--create a recurring time region--> 
    <dxsch:SchedulerControl.TimeRegionItems> 
        <dxsch:TimeRegionItem Type="Pattern"
		RecurrenceInfo="{dxsch:RecurrenceDaily Start='1/1/2019 13:00:00', ByDay=WorkDays}" 
		Start="1/1/2019 13:00:00" End="1/1/2019 14:00:00" 
		BrushName="{x:Static dxsch:DefaultBrushNames.TimeRegion4Hatch}" /> 
    </dxsch:SchedulerControl.TimeRegionItems> 
</dxsch:SchedulerControl>

The snippet above features a custom Time Region template that adds an SVG icon (a knife and fork) on top of the regular pattern.

Time Region with an icon

You can find this icon among thousands of others in our SVG Image Gallery.

Future Enhancements - Your Feedback Counts

One of the features we are planning to incorporate in the future is read-only functionality for appointments, resources, and time regions. Setting a resource or a Time Region to read-only would prevent end-users from adding new or modifying existing appointments within it. Would this feature be useful to you? We are interested in your thoughts and ideas! Please complete the survey and feel free to comment below or open Support Center tickets for further discussion.

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.