HeaderPane
Main
Hide
Share Link
Print

Date Ranges

With the SelectionMode property set to SelectionModeEnum.Range, a field or a calendar holds a range of dates instead of one date. A range can have any length, from one day to many years; the CalendarClass.MaxRangeDays property can limit it (0, the default, means no limit).

Range Fields

An SftDate control in range mode shows the first and the last date of the range, separated by the SftDate.RangeSeparator text. The SftDate.RangeStart and SftDate.RangeEnd properties hold the two dates, and the SftDate.Value property holds the first date. The SftDate.RangeChanged event occurs when either date changes.

The dropdown of a range field shows two months. The user clicks the first and then the last date of the range; the dropdown closes after the second click.

Range Calendars

In an SftCalendar control in range mode, the SftCalendar.RangeStart and SftCalendar.RangeEnd properties hold the selected range, and the SftCalendar.SelectRange method selects one. The SftCalendar.RangeChanged event occurs when the range changes. The days between the first and the last day are shown in the CalendarClass.RangeBackColor color.

The user selects a range with the mouse or the keyboard:

  • A click selects one day and starts a new range.
  • Shift+click extends the range to the clicked day, and dragging the mouse selects the days it passes over.
  • A click on a week number selects the week.
  • Shift with the arrow keys, Page Up, Page Down, Home and End extends the range.

C#

sftCalendar1.SelectionMode = SelectionModeEnum.Range;
sftCalendar1.SelectRange(new DateTime(2026, 11, 23), new DateTime(2026, 12, 11));

VB

SftCalendar1.SelectionMode = SelectionModeEnum.Range
SftCalendar1.SelectRange(New DateTime(2026, 11, 23), New DateTime(2026, 12, 11))