RadSlider thumb dragging issue

3 posts, 0 answers
  1. Abdelkarim
    Abdelkarim avatar
    3 posts
    Member since:
    Dec 2011

    Posted 28 May 2014 Link to this post

    Hi

    we have a RadSlider with IsSelectionRangeEnabled=True, our requirement is that both Thumbs should push one another while dragging.

    I would like that you confirm to me whether this is possible with the current RadSlider control. It seems that setting IsCoercionSuppressed to true or false does not yield our desired effect.

    Regards
    Abdelkarim
  2. Martin
    Admin
    Martin avatar
    1099 posts

    Posted 31 May 2014 Link to this post

    Hi Abdelkarim,

    The described functionality is not supported out of the box. However, you can implement it with custom logic. Basically you can get the Thumb elements (with the ChildrenOfType<T>() method) in the Loaded event handler of the RadSlider.Then add handlers for the DragDelta events of the thumbs and change update the thumbs position inside them.

    For your convenience I attached a sample project that demonstrates this approach. Note that this implementation is not well tested and I cannot guarantee that it will work in all possible cases. This is why I recommend you to take some time to test it and see if it's going to work for you.

    Regards,
    Martin
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Abdelkarim
    Abdelkarim avatar
    3 posts
    Member since:
    Dec 2011

    Posted 31 May 2014 in reply to Martin Link to this post

    Hi Martin,

    Thanks for your response, your solution was not what I am looking for, I wanted the thumbs to push each other only when they're adjacent, not when they're far from each other.

    but your sample gave me a hint to the solution, so Thank you.

    I achieved the solution by inheriting the RadSlider and subscribing for the events in the OnApplyTemplate method override, I then push a thumb only when there is a change and the distance between the two thumbs is zero.

    Regards
    Abdelkarim
Back to Top