4 Answers, 1 is accepted
0
Hi Ziad,
Yes, we expose different DragDrop events than the one on UIElement.
Please note that the RadDragAndDropManager does not work across different windows or different applications in WPF. If you need this functionality, you will still need to handle the built-in DragDrop events.
Otherwise you can find an example of drag-drop implementation between different controls in the online examples:
http://demos.telerik.com/wpf/
Go to DragDrop -> Tree to Grid
There you can see how some of the DragDrop events are handled to implement dragging products across different controls.
All the best,
Miroslav
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.
Yes, we expose different DragDrop events than the one on UIElement.
Please note that the RadDragAndDropManager does not work across different windows or different applications in WPF. If you need this functionality, you will still need to handle the built-in DragDrop events.
Otherwise you can find an example of drag-drop implementation between different controls in the online examples:
http://demos.telerik.com/wpf/
Go to DragDrop -> Tree to Grid
There you can see how some of the DragDrop events are handled to implement dragging products across different controls.
All the best,
Miroslav
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 12 Nov 2009, 10:02 AM
Hello Miroslav and thank you for your reply.
In my specific case, I have a three-level tree view hierarchy. The treeview has to abide by certain restrictions when it comes to drag/drop behavior. For example, you can only drag/drop items in the same 'level'. In addition, there is a default tree item which you cannot add items to. In order to accomplish this behavior, I need to capture events such as 'PreviewDrop' and 'PreviewDragEnter'. I tried attaching event handlers to 'DragDrop.PreviewDrop' and 'UIElement.PreviewDrop'. However, neither of these events were being fired when I was dropping items.
How can I capture these (or at least similar) events in order to control which items are allowed to be dragged and dropped?
Thank you.
In my specific case, I have a three-level tree view hierarchy. The treeview has to abide by certain restrictions when it comes to drag/drop behavior. For example, you can only drag/drop items in the same 'level'. In addition, there is a default tree item which you cannot add items to. In order to accomplish this behavior, I need to capture events such as 'PreviewDrop' and 'PreviewDragEnter'. I tried attaching event handlers to 'DragDrop.PreviewDrop' and 'UIElement.PreviewDrop'. However, neither of these events were being fired when I was dropping items.
How can I capture these (or at least similar) events in order to control which items are allowed to be dragged and dropped?
Thank you.
0
Accepted
Hi Ziad,
In your case you have to add a handler to RadDragAndDropManager.DropQueryEvent and handle even the handled events.
In the event handler you can place your logic for determining whether a drop is possible or not.
I have attached a sample project that demonstrates the above functionality with 3 level hierarchy. Have a look at it and let me know if it is of any help.
Sincerely yours,
Kiril Stanoev
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.
In your case you have to add a handler to RadDragAndDropManager.DropQueryEvent and handle even the handled events.
this
.AddHandler(RadDragAndDropManager.DropQueryEvent,
new
EventHandler<DragDropQueryEventArgs>(RadTreeView_DropQuery),
true
);
In the event handler you can place your logic for determining whether a drop is possible or not.
private
void
RadTreeView_DropQuery(
object
sender, Telerik.Windows.Controls.DragDrop.DragDropQueryEventArgs e)
{
bool
dropPossible =
this
.DetermineWhetherDropIsPossible();
if
(dropPossible)
{
e.QueryResult =
true
;
}
else
{
e.QueryResult =
false
;
}
}
I have attached a sample project that demonstrates the above functionality with 3 level hierarchy. Have a look at it and let me know if it is of any help.
Sincerely yours,
Kiril Stanoev
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 29 Dec 2009, 08:47 AM
Thank you Kiril, this is exactly what I was looking for.