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

Notification when the treeview gets re-arranged after dropping

3 Answers 70 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Lauren Nickerson
Top achievements
Rank 1
Lauren Nickerson asked on 06 Apr 2010, 09:24 PM
Hello.

Like the title says, I need a notification when the drag and drop operation is finished and the dropped item has been moved to it's correct position, this is because I need the new position of the item.

I'm not using the native D&D in the RadTreeView, but I'm using the RadDragAndDropManager to handle my D&D. Also as I was told here that in order to handle the D&D on my own I have to set the e.Handled to true in the PreviewDragEnded event.

So basically I just need an event that happens after:

1) The drop has finished
2) The tree view has been rearranged to update the new position of the dropped item

At that point, I should be able to find the dropped item and call this to get its new coordinates (reference):

GeneralTransform generalTransform = droppedItem.TransformToVisual( parentElement );
Point childToParentCoordinates = generalTransform.Transform( new Point( 0, 0 ) );

Let me know if this is possible. Thanks!

3 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 09 Apr 2010, 06:01 PM
Hello Lauren Nickerson,

If you need the coordinates of the point where you are dropping your items, you can handle the OnDropInfo() event and use the e.Options.CurrentDragPoint and e.Options.RelativeDragPoint properties to get the absolute and relative coordinates.

Also, I am not really sure if I understand your scenario correctly? Do you need the dragged items to be moved or copied?
If you need to copy the dragged items, you will have to handle the PreviewDragEnded() event and move your logic from the DragEnded() to the OnDropInfo() event because the former will not be called.

However, if you only want to move your items, you don't need to handle the PreviewDragEnded() event. You will only have to handle the OnDropInfo() event, where you can check the e.Options.Status property and insert your logic whenever the status is DropComplete.

I prepared an example for you to take a look at. Please let me know if this works for you or if you need more info.

Greetings,
Tina Stancheva
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
Lauren Nickerson
Top achievements
Rank 1
answered on 09 Apr 2010, 10:28 PM
0
Tina Stancheva
Telerik team
answered on 12 Apr 2010, 09:00 AM
Hello Lauren Nickerson,

I am very sorry for that.

I have left out the reference to the Telerik.Windows.Data.dll and this was causing the problem. I reattached the example, can you please try to run it now?

Greetings,
Tina Stancheva
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
Lauren Nickerson
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Lauren Nickerson
Top achievements
Rank 1
Share this question
or