RangeControlAdjustEventArgs.RangeMinimum Property
Gets or sets the start bound of the range that will be available in the RangeControl after it is automatically adjusted.
Namespace: DevExpress.XtraScheduler
Assembly: DevExpress.XtraScheduler.v24.2.Core.Desktop.dll
Declaration
Property Value
Type | Description |
---|---|
DateTime | A DateTime object that is start bound of the RangeControl’s total range. |
Remarks
Handle the SchedulerControl.RangeControlAutoAdjusting event and use the RangeMinimum and RangeControlAdjustEventArgs.RangeMaximum properties to customize boundaries of the RangeControl’s range before the control is displayed when auto-adjusting is applied (see the SchedulerOptionsRangeControl.AutoAdjustMode property). For example, you can specify how the RangeControl range will be recalculated when an end-user scrolls the scheduler to the date that is beyond the initial RangeControl range. You can define particular calculation conditions for each scheduler view.
The RangeMinimum value must be less than the RangeControlAdjustEventArgs.RangeMaximum value.
By default, if the SchedulerOptionsRangeControl.AutoAdjustMode is set to true, the following ranges are predefined to be set (depending on the current scheduler view) when an end-user scrolls the scheduler start date so that it is beyond the initial RangeControl range.
Scheduler View | RangeControl Total Range |
---|---|
RangeMinimum = the start of the scheduler visible interval - 1 month RangeMaximum = the start of the scheduler visible interval + 1 month | |
RangeMinimum = the first day of the month visible in the scheduler - 3 months RangeMaximum = the first day of the month visible in the scheduler + 3 months | |
RangeMinimum = the first day of the month visible in the scheduler - 6 months RangeMaximum = the first day of the month visible in the scheduler + 6 months | |
RangeMinimum = the start of the scheduler visible interval - twice the duration of the scheduler visible interval RangeMaximum = the start of the scheduler visible interval + twice the duration of the scheduler visible interval |
Example
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. To apply the specified format, disable the ScaleBasedRangeControlClientOptions.AutoFormatScaleCaptions option.
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. To apply the specified formats for scale headers, disable the ScaleBasedRangeControlClientOptions.AutoFormatScaleCaptions option.
Set the
RangeControlAdjustEventArgs.RangeMinimum
and RangeControlAdjustEventArgs.RangeMaximum properties so that RangeControl’s range will be the whole year including the month that is visible in the scheduler.
using System;
using System.Windows.Forms;
using DevExpress.XtraScheduler;
using DevExpress.XtraScheduler.Native;
namespace WindowsFormsApplication1 {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
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;
e.Scales.Clear();
TimeScaleMonth monthScale = new TimeScaleMonth();
monthScale.DisplayFormat = "MMMM yyyy";
e.Scales.Add(monthScale);
TwoWeekTimeScale twoWeekTimeScale = new TwoWeekTimeScale();
twoWeekTimeScale.Width = 120;
e.Scales.Add(twoWeekTimeScale);
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,
DateTimeHelper.FirstDayOfWeek);
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),
DateTimeHelper.GetWeekOfYear(end.AddTicks(-1)));
}
}
}