I'm performing Drag & Drop within a XamDataTree where there are "Product" nodes that can contain many "License" nodes. Currently, a user can drag a License to any Product node, but I want to only a allow a user to drag a License node to the correct Product for the license. I'm overriding the DragEnter and Drop events, and I have some custom logic (based on the objects that the tree is bound to) that determines if the drop should be allowed. I know I can set the DragDropCancelEventArgs.Cancel variable to true in the DragEnter event, and this works, but I don't want to completely cancel the operation until the drop is attempted. However, if I call DragDropManager.EndDrag(true) in the Drop event, it does nothing.
Any ideas on how to get this to work?
Valerie,
Thank you for the response. I have solved the problem.
Hello Daniel,
Do you have any other questions on this matter?
Sincerely,
Valerie
Developer Support Supervisor - XAML
Infragistics
www.infragistics.com/support
Hi Daniel,
I would recommend that you use your method of determining if you want to drop the node to control whether you add the Child. You wouldn't be canceling the event but you are in control of whether the node is dropped in the new location.
There is a sample for dragging xamDataTree nodes with a tree structure on this forum thread. Krasimir has a sample there that may be helpful to you. In his case he is controlling position and whether or not the data type is of the correct data type before adding the node.
http://ko.infragistics.com/community/forums/t/57497.aspx
You can acquire the target that you would be adding the child to by referencing the e.DropTarget. And the e.OriginalDragSource references the element you are dragging.
Then based on your requirements you add the node to the target's Nodes collection.
Please let me know if you have any questions.