Drag and Drop using the RadTreeView

10 posts, 0 answers
  1. Philip
    Philip avatar
    4 posts
    Member since:
    Oct 2008

    Posted 15 Mar 2010 Link to this post

    Hello

    I have a simple question. I have trying to implement a simple drag and drop operation from a RadTreeView node to another .NET control (in my case it is a control that represents a model diagram). I have failed so far. Can I do that with the RadTreeView control? I certainly can do with the .NET treeview control.

    Thanks for your help.

    Regards

    Philip

  2. Philip
    Philip avatar
    4 posts
    Member since:
    Oct 2008

    Posted 15 Mar 2010 Link to this post

    I just wanted to clarify that I am having a problem when the RadTreeView is inside a tool window.

    Regards

    Philip
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 17 Mar 2010 Link to this post

    Hi Philip,

    Thank you for the question.

    We are not sure what approaches you have tried, but you can achieve this easily by using the standard Control member events, namely DragEnter, DragOver etc. You can get the node that you are clicking on via the RadControl.GetElementAtPoint(). This method will return a TreeNodeUI which has an AssociatedRadTreeNode property (the logical node that you need).

    If you still find the implementation difficult I would be happy to provide a code snippet.

    I am looking forward to your reply.

     

    Kind regards,
    Victor
    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.
  5. Philip
    Philip avatar
    4 posts
    Member since:
    Oct 2008

    Posted 18 Mar 2010 Link to this post

    Hi Victor,

    Thanks for reply. I have managed to sort it out. It was just me being mixed up about the different events! I did hewever nortice that when I drag and drop a node on a surface, it draws some sort of a label with the name of the node on the surface. It disappears after I refresh the form.

    Regards

    Philip
  6. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 19 Mar 2010 Link to this post

    Hi Philip,

    Can you please post a screenshot of this case as we have not experienced such behavior before.
    I am looking forward to your reply.

    Sincerely yours,
    Victor
    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.
  7. Christoph
    Christoph avatar
    3 posts
    Member since:
    Jun 2010

    Posted 09 Sep 2010 Link to this post

    Hello,

    Currently I am experiencing the same problem as described above. When dragging from the treeview, the name of the node remains at the point where the mouse is released. In the attached file you find an image which shows the state after dragging.

    This is happening when dragging in the treeview itself and when dragging to RadScheduler.

    If I leave the active window and return to the one with the RadControls the controls works as expected.

    Regards,
    Christoph
  8. Christoph
    Christoph avatar
    3 posts
    Member since:
    Jun 2010

    Posted 09 Sep 2010 Link to this post

    Hello there,

    I managed to solve this problem with the help of this post: http://www.telerik.com/community/forums/winforms/treeview/cancel-selected-node-change-when-drag-and-drop.aspx. I mixed the OLE and Rad events, so dragging never came to an end and the drawn object remained on the screen.

    Kind regards,
    Christoph
  9. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 14 Sep 2010 Link to this post

    Hi Christoph,

    Thank you for your reply.

    I am glad to hear that you found the solution to your issue in our Online Help Documentation.

    Should you have any other questions, do not hesitate to contact me.
     
    Regards,
    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
  10. Christoph
    Christoph avatar
    3 posts
    Member since:
    Jun 2010

    Posted 15 Sep 2010 Link to this post

    Hello Stefan,

    Yes, I have another question I could not solve after a lot of investigation: When using resources on Telerik.WinControls.UI.RadScheduler, how do I find out the resource to which the dragged element is dropped to?

    Thank you for your reply!

    Regards,
    Christoph
  11. Dobry Zranchev
    Admin
    Dobry Zranchev avatar
    348 posts

    Posted 20 Sep 2010 Link to this post

    Hello Christoph,

    In order to take the correct resource according to when you drop an object from the treeview to the scheduler you should:
     
    1. Convert the position of the cursor to the RadSceduler control:
     
    Point point = this.radScheduler1.PointToClient(Cursor.Position);
     
    OR
    use the X and Y coordinates from the arguments of the DragDrop event of the Scheduler.
     
    2. Get the SchedulerDayViewGroupedByResourceElement from the RadScheduler
     
    SchedulerDayViewGroupedByResourceElement groupedDayViewElement = this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewGroupedByResourceElement;
     
    3. With the help of the SchedulerUIHelper class you could take the clicked cell via the cursor position
     
    SchedulerCellElement cellElement = SchedulerUIHelper.GetCellAtPoint(point, groupedDayViewElement.GetDayViewElements());
     
    4. Get the parent SchdulerDayViewElement from the cell
     
    SchedulerDayViewElement dayViewElement = cellElement.Parent.Parent.Parent.Parent.Parent.Parent as SchedulerDayViewElement;
     
    5. For the SchedulerDayViewElement you could easily take the resource that you looking for:
     
    dayViewElement.View.GetResources()[0]
     
    By the way, in grouping mode each day view contains just one resource.

    I hope that this will help you. If you have other questions, feel free to write us.
     

    Sincerely yours,
    Dobry Zranchev
    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
Back to Top
UI for WinForms is Visual Studio 2017 Ready