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

Drag a node from a treeview to something else.

6 Answers 67 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Jeff Bradshaw
Top achievements
Rank 1
Jeff Bradshaw asked on 04 Nov 2010, 08:58 PM
I have a treeeview and I need to be able to remove a node from it by dragging the node out of the treeview and into a datagrid. I can't figure out how to start the drag and drop actions - what events are fired?

Can anybody help please?

TIA - Jeff.

6 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 05 Nov 2010, 12:41 PM
Hi Jeff, 

The controls aren't specifically designed to allow drag and drop between different controls and I guess when dragging to a RadGridView you would need to perform some additional binding or adding of rows when dragging a node to it. 

However, the controls use the standard windows forms drag and drop events, which you can find out more about at this link

Hope that helps
Richard
0
Jeff Bradshaw
Top achievements
Rank 1
answered on 05 Nov 2010, 01:23 PM
Actually the issue seems to be that I can't get the drag to start in the treeview. Any help there?
0
Richard Slade
Top achievements
Rank 2
answered on 05 Nov 2010, 01:30 PM
Hi Jeff, 

To get the drag going, try this.. 

Private Sub TreeView_MouseDown(ByVal sender As System.Object, _
    ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeView.MouseDown
 
    If TreeView.SelectedNodes.Count > 0 Then
        Dim text As String = TreeView.SelectedNode.Text
        TreeView.SelectedNode = Nothing
        TreeView.Cursor = Cursors.Arrow
        TreeView.DoDragDrop(text, DragDropEffects.Copy Or DragDropEffects.Move)
    End If
End Sub

let me know if that helps
Richard
0
Richard Slade
Top achievements
Rank 2
answered on 09 Nov 2010, 03:26 PM
Hi Jeff, 

Did this help? If so, please remember to mark as answer. 
Otherwise, let me know if you need anything else
Richard
0
Stefan
Telerik team
answered on 10 Nov 2010, 03:39 PM
Hi Jeff,

Thank you for writing.

Richard's suggestion is correct, I just wanted to add one link to a help article regarding the process of working with RadTreeView and the Drag and Drop operations.

I hope you find this information helpful. Should you need any further assistance, do not hesitate to write back.

Sincerely yours,
Stefan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Stefan
Telerik team
answered on 22 Mar 2011, 03:21 PM
Hello guys,

Please note that in Q1 2011 we have introduced a major upgrade of RadTreeView control, which is now virtualized and fully customizable. Feel free to download the latest release and try it out. For more information on our latest release refer to this blog post.

Best wishes,
Stefan
the Telerik team

Tags
Treeview
Asked by
Jeff Bradshaw
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Jeff Bradshaw
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or