Prevent Auto-Expand of Nodes during Drag and Drop?

3 posts, 1 answers
  1. Brendan
    Brendan avatar
    52 posts
    Member since:
    Dec 2011

    Posted 20 Jun 2013 Link to this post

    I want to disable treenode auto-expansion for certain nodes when I drag a treenode .  I tried the DragOverEvent but it did not do what I wanted.  I know the Animation property was not correct, but couldn't find anything else.

    Private Sub tvwSetup_DragOverNode(sender As Object, e As RadTreeViewDragCancelEventArgs) Handles tvwSetup.DragOverNode
     
         'disable expansion for nodes with values < 100
         If e.TargetNode.Value < 100 Then tvwSetup.ExpandAnimation = ExpandAnimation.None
    End Sub

    I've seen a solution for ASP using the "OnClientNodeExpanding" event.  Can such a thing be done in the Winforms treeview?
  2. Answer
    Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 25 Jun 2013 Link to this post

    Hi Brendan,

    Thank you for writing.

    You can do that by using the NodeExpandedChanging event of RadTreeView, where you can cancel the expansion if a drag operation is working:
    void radTreeView1_NodeExpandedChanging(object sender, RadTreeViewCancelEventArgs e)
    {
        e.Cancel = radTreeView1.TreeViewElement.DragDropService.State == RadServiceState.Working;
    }

    I hope that this works for you.
     

    Regards,
    Stefan
    Telerik
    RadChart for WinForms is obsolete. Now what?
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Brendan
    Brendan avatar
    52 posts
    Member since:
    Dec 2011

    Posted 25 Jun 2013 Link to this post

    Thanks Stefan.  You guys are the best!
Back to Top