Delay Auto-expand of nodes during drag drop

3 posts, 1 answers
  1. Amand
    Amand avatar
    25 posts
    Member since:
    Aug 2012

    Posted 09 Jul 2013 Link to this post

    Hi Telerik support,

    IWhen using drag-drop in the treeview, there is an auto expand behaviour to be able to move a node inside another. Currently, the time required on a node to exapand it is very short. Is it possible to modify this time to expand the node only after a longer time.

    I found a post to disable this behaviour ( but not to modify the delay.

  2. Answer
    Dimitar avatar
    2563 posts

    Posted 11 Jul 2013 Link to this post

    Hello Amand,

    Thank you for writing.

    The are a few steps to delay the node expanding:
    1. Create a timer and attach an event handler for the tick event to it.
    2. Set the timer Interval property to the desired delay time.
    3. Handle the RadTreeView DragOverNode and NodeExpandedChanging events.
    4. Create a bool variable and initialize it to false.
    5. Create a RadTreeNode object to store the node which we will expand later.
    6. Set the created variable to true in the DragOverNode event handler.
    7. In the NodeExpandedChanging event handler check the variable and if its value is true cancel the default behavior, start the timer and set our bool variable to false.
    8. The last step is implement the timer tick event handler. In it we just need to expand the current node and stop the timer.

    I have attached a sample project which implements the described logic.

    I hope this helps. Should you have any other questions do not hesitate to ask.

    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>

  3. Amand
    Amand avatar
    25 posts
    Member since:
    Aug 2012

    Posted 11 Jul 2013 Link to this post


    Thanks for the answer.
    I may try this, but doing all the auto-expand seems quite complicated, dealing with all the cases, some of these you did not address in your example (move to other nodes, stopping, doing the drop, ...).
    Anyway, that's a good lead, I'll keep you posted if I have further questions.

Back to Top