Hello!
I have a DateTimerangeSlider, I would like to set only two hours within a day but only every 30 minutes should be selectable (for instance 8:30 - 16:00). Is it possible somehow with stepduration? My code so far:
Thank you in advance!
Hi Ferenc,
Could you please provide us with some additional information about your requirements so that we can better understand your needs? If it is possible, it would be helpful if you could give us an image that illustrates your expected output.
Regards,
Raja.
Hello Raja,
acutally, I just would like to select two times between 08:00 and 17:00 but only times divisible by 30 should be selected, so, 8:00, 8:30, 9:00, etc..
Regards,
Ferenc
Hi Ferenc,
To achieve your requirement, we can make use of the "StepDuration" property available in the DateTimeRangeSlider. The StepDuration property enables discrete selection, as opposed to continuous selection, of values along the slider range. When setting the StepDuration property, you can specify the step value for each date and time component in the order of years, months, days, hours, minutes, and seconds.
We can enable discrete selection of only every 30 minutes along the slider range by setting the "StepDuration" property to "0,0,0,0,30" as per the code snippet.
<sliders:SfDateTimeRangeSlider Minimum="09:00:00" Maximum="17:00:00" RangeStart="10:30:00" RangeEnd="12:30:00" StepDuration="0,0,0,0,30" MinorTicksPerInterval="1" Interval="1" IntervalType="Hours" ShowTicks="True" DateFormat="hh:mm" ShowLabels="True"> </sliders:SfDateTimeRangeSlider> |
StepDuration can be set in code behind, as shown below.
sfSlider.StepDuration = new SliderStepDuration(0, 0, 0, 0, 30); |
Also visit this documentation for more information:
https://help.syncfusion.com/maui/datetime-range-slider/selection#discrete-selection
Best Regards,
Raja.
Dear Raja,
thank you so much for your help. I didn't use properly the Stepduration prperty first (U used onlly Stepduration="1") but now I get it and it works as expected!
Thank you again!
BR
Ferenc