Fire SelectionRangeChanged only when mouse button is up

3 posts, 1 answers
  1. Adrien
    Adrien avatar
    10 posts
    Member since:
    Nov 2010

    Posted 10 Dec 2010 Link to this post

    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. Answer
    Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 15 Dec 2010 Link to this post

    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
  3. DevCraft banner
  4. Adrien
    Adrien avatar
    10 posts
    Member since:
    Nov 2010

    Posted 15 Dec 2010 Link to this post

    Thanks Petar, this is exactly what I was looking for.

    Best,

    Adrien
Back to Top