Drag a node from a treeview to something else.

7 posts, 0 answers
  1. Jeff Bradshaw
    Jeff Bradshaw avatar
    27 posts
    Member since:
    Oct 2008

    Posted 04 Nov 2010 Link to this post

    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.
  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 05 Nov 2010 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Jeff Bradshaw
    Jeff Bradshaw avatar
    27 posts
    Member since:
    Oct 2008

    Posted 05 Nov 2010 Link to this post

    Actually the issue seems to be that I can't get the drag to start in the treeview. Any help there?
  5. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 05 Nov 2010 Link to this post

    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
  6. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 09 Nov 2010 Link to this post

    Hi Jeff, 

    Did this help? If so, please remember to mark as answer. 
    Otherwise, let me know if you need anything else
    Richard
  7. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 10 Nov 2010 Link to this post

    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
  8. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 22 Mar 2011 Link to this post

    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

Back to Top
UI for WinForms is Visual Studio 2017 Ready