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

Drag and Drop using the RadTreeView

9 Answers 291 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Philip
Top achievements
Rank 1
Philip asked on 15 Mar 2010, 11:24 AM
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

9 Answers, 1 is accepted

Sort by
0
Philip
Top achievements
Rank 1
answered on 15 Mar 2010, 02:09 PM
I just wanted to clarify that I am having a problem when the RadTreeView is inside a tool window.

Regards

Philip
0
Victor
Telerik team
answered on 17 Mar 2010, 06:30 PM
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.
0
Philip
Top achievements
Rank 1
answered on 18 Mar 2010, 07:02 AM
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
0
Victor
Telerik team
answered on 19 Mar 2010, 02:54 PM
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.
0
Christoph
Top achievements
Rank 1
answered on 09 Sep 2010, 10:34 AM
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
0
Christoph
Top achievements
Rank 1
answered on 09 Sep 2010, 03:27 PM
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
0
Stefan
Telerik team
answered on 14 Sep 2010, 03:35 PM
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
0
Christoph
Top achievements
Rank 1
answered on 15 Sep 2010, 08:39 AM
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
0
Dobry Zranchev
Telerik team
answered on 20 Sep 2010, 04:19 PM
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
Tags
Treeview
Asked by
Philip
Top achievements
Rank 1
Answers by
Philip
Top achievements
Rank 1
Victor
Telerik team
Christoph
Top achievements
Rank 1
Stefan
Telerik team
Dobry Zranchev
Telerik team
Share this question
or