Hello!
I'm currently trying to drag and drop a node from a XamDataTree to a WPF UserControl.
I'm not really into the Drag&Drop topic and just wondered if it is possible to trigger an event in the UserControl when the node has been dropped.
At the moment all I achieved is triggering the NodeDragDrop event on the XamDataTree with following code:
<ig:XamDataTree NodeDragDrop="xamDataTree1_NodeDragDrop" IsDraggable="True" IsDropTarget="True" Name="xamDataTree1" VerticalAlignment="Top" ><ig:XamDataTree.GlobalNodeLayouts><ig:NodeLayout Key="ContinentLayout" TargetTypeName="Continent" DisplayMemberPath="Name"/></ig:XamDataTree.GlobalNodeLayouts></ig:XamDataTree>
I'd like to have something like <UserControl NodeDropped="UserConctrol_NodeDropped"/>
private void UserConctrol_NodeDropped(object sender, DropEventArgs e){ var x = e.Data;}
Hello Nicolas,
I have reviewed your requirement further and it seems that the DragSource object triggers all events related with our Drag and Drop framework. You can see all public events, methods and properties for DragSource and DropTarger from our documentation.
If your end goal is to determine what is the element you are over while dragging, I can suggest to use the DragOver event , this way from the DragDropMoveEventArgs you can access the current object marked as drop target.
In order to use this event you have to implement the Drag and Drop framework yourself, since the build-in drag and drop functionality in XamDataTree was designed to be used inside the tree.
I have modified the sample application from the thread I have mentioned in order to show you how can handle the DragOver and how to implement our Drag and Drop framework.
Please let me know if you have any questions.
Sincerely,ZhivkoAssociate Software Developer
Hello Zhivko,
thanks for you reply!
I looked at this thread and its samples and there is an event triggered in the DragSource when a node is dropped. But I'm looking for a similar event that would be triggered in the DragTarget. I don't know if this is even possible. But in that way my DragTarget could decide what to do with the dropped data and the source would'nt care about it at all.
But if that's how it is supposed to be done, then I will have to deal with that.
I have reviewed your question regarding how to drags a treenode to a usercontrol and I suggest to take a look at the following forum thread where similar behavior was discussed:
https://ko.infragistics.com/community/forums/t/84559.aspx