Radtreenode get location

2 posts, 0 answers
  1. Anuj
    Anuj avatar
    2 posts
    Member since:
    Jun 2014

    Posted 30 Jun 2014 Link to this post


    I am using telerik Radtreeview. and i am performing drag and drop from radtreeview to RadScrollablePanel.
    it is working fine but i the treenode which i drag and drop in panel goes to top-left location every time.
    i want to place it where i leave the cursor.
    means the location of treenode when i drop should be the where i leave my cursor.
    (like google map pin).

    Please reply.

  2. Dimitar
    Dimitar avatar
    1321 posts

    Posted 02 Jul 2014 Link to this post

    Hello Anuj,

    Thank you for contacting us.

    You can set the location of the dropped element in the PreviewDragDrop event. For example you can perform the entire drag and drop operation as follows:
    public Form1()
        radTreeView1.AllowDragDrop = true;
        radScrollablePanel1.PanelElement.AllowDrop = true;
        radTreeView1.TreeViewElement.DragDropService.PreviewDragOver += DragDropService_PreviewDragOver;
        radTreeView1.TreeViewElement.DragDropService.PreviewDragDrop += DragDropService_PreviewDragDrop;
    void DragDropService_PreviewDragDrop(object sender, Telerik.WinControls.RadDropEventArgs e)
        RadScrollablePanelElement element = e.HitTarget as RadScrollablePanelElement;
        if (element != null)
            RadLabel label = new RadLabel();
            label.Location = e.DropLocation;
            label.Text = ((TreeNodeElement)e.DragInstance).Data.Text;
    void DragDropService_PreviewDragOver(object sender, Telerik.WinControls.RadDragOverEventArgs e)
        e.CanDrop = e.HitTarget is RadScrollablePanelElement;

    Please let me know if there is something else I can help you with. 
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
  3. DevCraft R3 2016 release webinar banner
Back to Top