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

Prevent Auto-Expand of Nodes during Drag and Drop?

2 Answers 92 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Brendan
Top achievements
Rank 1
Brendan asked on 20 Jun 2013, 06:42 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 25 Jun 2013, 01:25 PM
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?
0
Brendan
Top achievements
Rank 1
answered on 25 Jun 2013, 01:40 PM
Thanks Stefan.  You guys are the best!
Tags
Treeview
Asked by
Brendan
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Brendan
Top achievements
Rank 1
Share this question
or