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

Drap/Drop Item's Parent

4 Answers 89 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ziad
Top achievements
Rank 1
Ziad asked on 13 Jan 2010, 09:34 AM
Hello,

I want to perform my own custom logic whenever an item is dragged/dropped. This procedure requires me to access the item's parent. I noticed that when I drag items and then drop them, in the RadTreeView.DragEnded event, the item's ParentItem property becomes null and the FullPath string property is also cleared.

Is this the correct event to handle for my custom logic (i.e. performing the "drop" in the business logic)? If so, how can I get the item's parent before it was dragged (i.e. its current parent).

Thank you.

4 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 13 Jan 2010, 09:40 AM
Hello Ziad,

You can handle the PreviewDragStarted event adn to check there the ParentItem property.

Sincerely yours,
Valentin.Stoychev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ziad
Top achievements
Rank 1
answered on 13 Jan 2010, 09:47 AM
The parent item does indeed appear in that event. However, I want an event where I can implement my "drop" logic. For example, the drag started event is fired as soon as the drag starts. So the user might end up dragging an item and then canceling the drag or picking an invalid item to drag into. Is there an event that is only called when the item is being dropped? The drag ended event that I chose to handle is only fired when a drop is successful.
0
Accepted
Valentin.Stoychev
Telerik team
answered on 13 Jan 2010, 02:54 PM
Hello Ziad,

Actually in your case it will be best if you use the PreviewDragEnded event. When this event is raised the dragged items are still not removed from their original parents and you can implement your logic there.

Sincerely yours,
Valentin.Stoychev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ziad
Top achievements
Rank 1
answered on 14 Jan 2010, 01:31 PM
Thank you Valentin, the PreviewDragEnded event works as expected.
Tags
TreeView
Asked by
Ziad
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
Ziad
Top achievements
Rank 1
Share this question
or