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

No drag/drop events currently being fired from RadTreeView

5 Answers 102 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Praveen
Top achievements
Rank 1
Praveen asked on 25 Nov 2015, 11:02 AM

Currently, I'm trying to use Drag/Drop in my application however none of the events in relation to this are firing. Is this a known issue? If so, are there workarounds?

I've also tried to use ItemDoubleClick even which is also not getting fired. 

Please do let me know. 

TIA

5 Answers, 1 is accepted

Sort by
0
Ivan
Telerik team
answered on 26 Nov 2015, 12:20 PM
Hi Praveen,

Are you trying to attach to the events described in the Drag and Drop article? If so, keep in mind that before Q2 2014 we used RadDragAndDropManager that uses these events. Since Q2 2014 our TreeView uses new drag/drop implementation through DragDropManager. So far the events cannot be attached from the XAML and this needs to be done in c# code:
private void SubscribeToDragDropEvents()
{
   DragDropManager.AddDragInitializeHandler(this.radTreeView, 
this.HandleDragInitialize, true);
   DragDropManager.AddDragDropCompletedHandler(this.radTreeView, this.HandleDragDropCompleted, true);
}
 
private void HandleDragInitialize(object sender, DragInitializeEventArgs e)
{
   MessageBox.Show("Handle drag initialize");
   e.Handled = true;
}
 
private void HandleDragDropCompleted(object sender, DragDropCompletedEventArgs e)
{
    MessageBox.Show("Handle drag drop completed");
    e.Handled = true;
}

You can also read about the DragDropManager here.

About the double click event, I test it on my side and it is fired as expected.

Please find a simple demonstration of using these events with the TreeView project attached. 

If you have further problems with this please let us know and if possible provide us with a sample project demonstrating those issues.

Regards,
Ivan
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Praveen
Top achievements
Rank 1
answered on 01 Dec 2015, 08:56 AM
Thanks Ivan. I used OnDropComplete and OnDrop instead. Now the problem I am facing is how to drop the dragged item into the new location. I need to drop an item from one location in RadTreeView to another.
0
Accepted
Ivan
Telerik team
answered on 01 Dec 2015, 09:52 AM
Hello Praveen,

Normally, RadTreeView supports drag and drop functionality out of the box. You can enable it by setting the IsDragDropEnabled property to true. In the example I gave you the drag/drop doesn't work as expected because of the code in the DragInitialize event handler.
private void HandleDragInitialize(object sender, DragInitializeEventArgs e)
{
   MessageBox.Show("Handle drag initialize");
   e.Handled = true;
}
The MessageBox in the handler takes the mouse focus. If you comment it you will be able to change the position of the item in the tree.

If this is not your case please provide us with an example demonstrating the issue, so we can give you more specific ways to resolve it.

Regards,
Ivan
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Rami
Top achievements
Rank 1
Veteran
answered on 21 Nov 2018, 06:13 AM

[quote]Ivan said:Since Q2 2014 our TreeView uses new drag/drop implementation through DragDropManager. So far the events cannot be attached from the XAML and this needs to be done in c# code[/quote]

 

Is it still the case that the drag and drop events for the new DragDropManager can't be attached through XAML? Will this be changed anytime in the future?

 

Regards, Rami

0
Martin Ivanov
Telerik team
answered on 23 Nov 2018, 11:10 AM
Hello Rami,

This is still the case - the DragDropManager events cannot be attached in XAML. At this point there are not plans for introducing this. 

Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
TreeView
Asked by
Praveen
Top achievements
Rank 1
Answers by
Ivan
Telerik team
Praveen
Top achievements
Rank 1
Rami
Top achievements
Rank 1
Veteran
Martin Ivanov
Telerik team
Share this question
or