Skip to main content

RangeControlAdjustEventArgs Class

Provides data for the SchedulerControl.RangeControlAutoAdjusting event.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v22.1.Core.Desktop.dll


public class RangeControlAdjustEventArgs :


The SchedulerControl.RangeControlAutoAdjusting event occurs before the RangeControl’s scales and range are changed to automatically adjust the RangeControl when an active view or start date of the bound SchedulerControl is changed. The RangeControlAdjustEventArgs class introduces the RangeControlAdjustEventArgs.Scales property that specifies a set of scales that are visible in the RangeControl. The RangeControlAdjustEventArgs.RangeMinimum and RangeControlAdjustEventArgs.RangeMaximum properties specify boundaries of the time range to be available in the RangeControl.

An instance of the RangeControlAdjustEventArgs class with appropriate settings is automatically created and passed to the corresponding event’s handler.


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.

  1. Set the SchedulerOptionsRangeControl.AutoAdjustMode option to true.
  2. 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:

using System;
using System.Windows.Forms;
using DevExpress.XtraScheduler;
using DevExpress.XtraScheduler.Native;

namespace WindowsFormsApplication1 {
    public partial class Form1 : Form {
        public Form1() {

        private void schedulerControl1_RangeControlAutoAdjusting(object sender,
                                                                RangeControlAdjustEventArgs e) {
            schedulerControl.OptionsRangeControl.AutoFormatScaleCaptions = true;
            SchedulerViewType activeViewType = schedulerControl.ActiveViewType;

            if (activeViewType == SchedulerViewType.WorkWeek) {
                schedulerControl.OptionsRangeControl.AutoFormatScaleCaptions = false;
                e.Scales[4].DisplayFormat = "dddd";
                e.Scales[4].Width = 70;

            if (activeViewType == SchedulerViewType.Month) {
                schedulerControl.OptionsRangeControl.AutoFormatScaleCaptions = false;


                TimeScaleMonth monthScale = new TimeScaleMonth();
                monthScale.DisplayFormat = "MMMM yyyy";

                TwoWeekTimeScale twoWeekTimeScale = new TwoWeekTimeScale();
                twoWeekTimeScale.Width = 120;

                e.RangeMinimum = new DateTime(e.RangeMinimum.Year, 1, 1);
                e.RangeMaximum = e.RangeMinimum.AddYears(1);

    public class TwoWeekTimeScale : TimeScaleFixedInterval {
        public TwoWeekTimeScale()
            : base(TimeSpan.FromDays(14)) {
        public override DateTime Floor(DateTime date) {
            DateTime startOfWeeek = DateTimeHelper.GetStartOfWeekUI(date,
            if (DateTimeHelper.GetWeekOfYear(date) % 2 == 0)
                return startOfWeeek.AddDays(-7);

            return startOfWeeek;
        public override string FormatCaption(DateTime start, DateTime end) {
            string dateString = "Week {0} - Week {1}";
            return String.Format(dateString, DateTimeHelper.GetWeekOfYear(start),

The following code snippets (auto-collected from DevExpress Examples) contain references to the RangeControlAdjustEventArgs class.


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.


See Also