This is a migrated thread and some comments may be shown as answers.

Fire SelectionRangeChanged only when mouse button is up

2 Answers 87 Views
Slider
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Adrien
Top achievements
Rank 1
Adrien asked on 10 Dec 2010, 12:35 PM
Hello,

I'm currently using the RadSlider control (with Range mode) to filter out data coming from the server. Each change in the selected range must request new data on the server, I thus handle the SelectionRangeChanged.

However, the SelectionRangeChanged event is fired as soon as the range changes, even in the case the mouse button has not been released. In other words, assume the ticks have a high frequency, if the user wants to move the SelectionStart handle a long way close to the Maximum value of the slider, it will fire a lot of SelectionRangeChanged events for all the intermediary values.

As I am only interested in the final range - the range displayed when he releases the mouse left button - how can I avoid requesting the server for all the intermediary values?

Thank you.

2 Answers, 1 is accepted

Sort by
0
Accepted
Petar Mladenov
Telerik team
answered on 15 Dec 2010, 05:20 PM
Hi Adrien,

RadSlider has a property called IsDeferredDraggingEnabled which you can use in this particular scenario.

<StackPanel Width="400" VerticalAlignment="Top" Margin="10">
    <telerik:RadSlider IsSelectionRangeEnabled="True" Minimum="0" Maximum="10"
            SelectionStart="4" SelectionEnd="6" TickFrequency="1" TickPlacement="Both"
            IsDeferredDraggingEnabled="True"
            SelectionRangeChanged="RadSlider_SelectionRangeChanged" />
    <ListBox BorderThickness="0" x:Name="log" />
</StackPanel>

private void RadSlider_SelectionRangeChanged(object sender, RoutedPropertyChangedEventArgs<Telerik.Windows.Controls.SelectionRangeChangedEventArgs> e)
{
    log.Items.Add(string.Format("SelectionRangeChanged: {0} ::: {1}", Math.Round(e.NewValue.SelectionStart, 1), Math.Round(e.NewValue.SelectionEnd, 1)));
}

Hope this was what you had in mind. Feel free to ask if you need further assistance.


Regards,
Petar Mladenov
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Adrien
Top achievements
Rank 1
answered on 15 Dec 2010, 05:42 PM
Thanks Petar, this is exactly what I was looking for.

Best,

Adrien
Tags
Slider
Asked by
Adrien
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Adrien
Top achievements
Rank 1
Share this question
or