Limiting SfRangeSlider to a particular value without changing Maximum property

Hi,

I would like to have an SfRangeSlider with a Minimum of 0 and a Maximum of 100. The slider should not be able to be moved above a certain limit value in my viewmodel, but the Maximum property should remain 100. For example, if the limit is 70, the slider should be able to go up 70% of the total slider length, and is impossible for the user to move it above this until the limit is changed. Is this possible to achieve?

Thank you.

3 Replies 1 reply marked as answer

RS Ruba Shanmugam Syncfusion Team September 24, 2020 10:08 AM UTC

Hi Louis, 
Greetings from Syncfusion. 
We have validated your query and your requirement is achieved by using ValueChanging event in the RangeSlider.  
Please have a sample from the below link. 
Code Snippet: 
XAML: 
<range:SfRangeSlider x:Name="rangeslider"  
                             Minimum="0"  
                             Maximum="100" 
                             ShowRange="False" 
                             Orientation="Horizontal" 
                             StepFrequency="10" 
                             TickFrequency="20" 
                             ValueChangeMode="OnThumb" 
                             ValueChanging="rangeslider_ValueChanging" 
                             ShowValueLabel="True" 
                             Value="70"/> 
XAML.cs: 
private void rangeslider_ValueChanging(object sender, Syncfusion.SfRangeSlider.XForms.ValueEventArgs e) 
        { 
            if(rangeslider.Value >= 70) 
            { 
                rangeslider.Value = 70; 
            } 
        } 
 
 
In this sample, we set the RangeSlider Limitation value to 70 and when you tried to move the slider above 70 again set the limit in the ValueChanging event. 
Please let us know, if you have any other concerns. 
Regards, 
Ruba Shanmugam 


Marked as answer

LO Louis October 5, 2020 04:54 AM UTC

That's working well, thank you!


SP Sakthivel Palaniyappan Syncfusion Team October 6, 2020 04:29 AM UTC

Hi Louis,

Thanks for the update.

We are glad to know that  reported problem has been resolved at your end. Please get back us if you need further assistance on this.

Regards,
Sakthivel P.


Loader.
Up arrow icon