Basic features in .NET MAUI DateTime Range Slider

29 Jun 20222 minutes to read

This section explains how to add the DateTime Range Slider (SfDateTimeRangeSlider) to your application.

Minimum

The minimum value that the user can select. The default value of the Minimum property is null. The Minimum value must be less than the Maximum value.

Maximum

The maximum value that the user can select. The default value of the Maximum property is null. The Maximum value must be greater than the Minimum value.

Range values

It represents the values currently selected in the DateTime Range Slider. The thumb is drawn corresponding to this RangeStart and RangeEnd values.

For date values, the range slider does not have auto interval support. So, setting Interval, IntervalType, and DateFormat for date values is mandatory.

<sliders:SfDateTimeRangeSlider Minimum="2010-01-01" 
                               Maximum="2020-01-01" 
                               RangeStart="2012-01-01" 
                               RangeEnd="2018-01-01" 
                               ShowLabels="True">
</sliders:SfDateTimeRangeSlider>
SfDateTimeRangeSlider rangeSlider = new SfDateTimeRangeSlider();
rangeSlider.Minimum = new DateTime(2010, 01, 01);
rangeSlider.Maximum = new DateTime(2020, 01, 01);
rangeSlider.RangeStart = new DateTime(2012, 01, 01);
rangeSlider.RangeEnd = new DateTime(2018, 01, 01);
rangeSlider.ShowLabels = true;

RangeSlider date label