SchedulerControl.RangeControlAutoAdjusting Event
Occurs before the RangeControl has been automatically adjusted when the scheduler active view or start date is changed.
Namespace: DevExpress.Xpf.Scheduler
Assembly: DevExpress.Xpf.Scheduler.v18.2.dll
Declaration
Event Data
The RangeControlAutoAdjusting event's data class is RangeControlAdjustEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
RangeMaximum | Gets or sets the end bound of the range that will be available in the RangeControl after it is automatically adjusted. |
RangeMinimum | Gets or sets the start bound of the range that will be available in the RangeControl after it is automatically adjusted. |
Scales | Provides access to the collection of scales that will be visible in the RangeControl after it is automatically adjusted. |
Remarks
Important
You are viewing documentation for the legacy WPF Scheduler control. If you’re starting a new project, we strongly recommend that you use a new control declared in the DevExpress.Xpf.Scheduling namespace. If you decide to upgrade an existing project in order to switch to the updated scheduler control, see the Migration Guidelines document.
When switching the scheduler active view, or navigating the SchedulerControl so that its SchedulerControl.Start date is beyond the bound RangeControl’s available time range, you can change scales and display formats for the RangeControl by handling the RangeControlAutoAdjusting event.
Note
The RangeControlAutoAdjusting event is fired only if the SchedulerOptionsRangeControl.AutoAdjustMode is set to true.
Use the event arguments to customize the RangeControl scales (RangeControlAdjustEventArgs.Scales) and total range boundaries (RangeControlAdjustEventArgs.RangeMinimum, RangeControlAdjustEventArgs.RangeMaximum) to be applied when adjusting the RangeControl. To review the default auto-adjust settings, see the SchedulerOptionsRangeControl.AutoAdjustMode property description.
This example demonstrates how to customize the auto-adjusting settings before they are applied to the RangeControl when an end-user switches the scheduler to the Work-Week or Month view.
- Set the SchedulerOptionsRangeControl.AutoAdjustMode option to true.
Handle the
SchedulerControl.RangeControlAutoAdjusting
event. In this event handler, specify the RangeControl scales and range to be set when the Work-Week or Month view becomes active in the following way:Work-Week
By default, if the AutoAdjustMode option is enabled and an end-user switches the scheduler view to Work-Week, the RangeControl’s collection of scales (the RangeControlAdjustEventArgs.Scales property) includes all default scales (Year, Quarter, Month, Week, Day, Hour, 15 Minutes), and the Week and Day scales are visible.
Leave this collection unchanged, but customize TimeScale.DisplayFormat and TimeScale.Width of the Day scale.
Month
By default, if the AutoAdjustMode option is enabled and an end-user switches the scheduler view to Month, the RangeControl’s collection of scales (the RangeControlAdjustEventArgs.Scales property) includes all default scales (Year, Quarter, Month, Week, Day, Hour, 15 Minutes), and the Month and Week scales are visible.
Clear the RangeControlAdjustEventArgs.Scales collection and specify new scales to be displayed in the RangeControl for the scheduler Month view. For example, add the TimeScaleMonth scale with the specified TimeScale.DisplayFormat and implement your own custom scale with a two-week interval and scale headers showing week numbers by inheriting it from the TimeScaleFixedInterval class.
Set the RangeControlAdjustEventArgs.RangeMinimum and RangeControlAdjustEventArgs.RangeMaximum properties so that RangeControl’s range will encompass the whole year including the month that is visible in the scheduler.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-customize-the-rangecontrol-auto-adjustment-behavior-e5122.
<dx:DXWindow
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:dxsch="http://schemas.devexpress.com/winfx/2008/xaml/scheduler" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" x:Class="SchedulerRangeControlExample.MainWindow"
Title="MainWindow" Height="600" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="150" />
<RowDefinition Height="20"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<dxe:RangeControl>
<dxsch:SchedulerRangeControlClient SchedulerControl="{Binding ElementName=scheduler}"/>
</dxe:RangeControl>
<dxsch:SchedulerControl x:Name="scheduler" Grid.Row="2" VerticalAlignment="Stretch" ActiveViewType="WorkWeek" RangeControlAutoAdjusting="schedulerControl1_RangeControlAutoAdjusting" >
</dxsch:SchedulerControl>
</Grid>
</dx:DXWindow>
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the RangeControlAutoAdjusting event.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.