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

Selecting after drag/drop

1 Answer 27 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Derek
Top achievements
Rank 1
Derek asked on 31 Oct 2008, 06:38 PM
This is probably a dumb question but I can't seem to figure it out.  How can I select the node that just got dropped somewhere?  I know of the .selected property but I am not sure how to reference it.  Here is my drag & drop code:

Private Shared Sub PerformDragAndDrop(ByVal dropPosition As RadTreeViewDropPosition, ByVal sourceNode As RadTreeNode, ByVal destNode As RadTreeNode) 
        If (sourceNode.Equals(destNode) OrElse sourceNode.IsAncestorOf(destNode)) Then 
            Return 
        End If 
        sourceNode.Owner.Nodes.Remove(sourceNode) 
        Select Case (dropPosition) 
            Case RadTreeViewDropPosition.Over 
                ' child 
                If Not sourceNode.IsAncestorOf(destNode) Then 
                    destNode.Nodes.Add(sourceNode) 
                End If 
            Case RadTreeViewDropPosition.Above 
                ' sibling - above                     
                destNode.InsertBefore(sourceNode) 
            Case RadTreeViewDropPosition.Below 
                ' sibling - below 
                destNode.InsertAfter(sourceNode) 
        End Select 
    End Sub 

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 03 Nov 2008, 01:08 PM
Hi Derek,

I suggest you use the following code line right after Select Case statement:

sourceNode.Selected = true 

Kind regards,
Yana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
TreeView
Asked by
Derek
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or