Hey there,
We've got a XamDataTree where we allow dragging and dropping within the tree. Some of the properties on the underlying data item need to be updated when being dragged into a new place, and when copying we're able to handle that because we simply create a new data item as a part of the NodeDragDrop event and update those properties as a part of the new data item. But what about when moving? How can I capture that and update just a couple of the properties on the underlying data item that's being moved?
You should hook NodeDraggingStart event when moving.
More details about this is in our documenation:https://es.infragistics.com/help/wpf/xamdatatree-xamdatatree-drag-and-drop
As far as updating the underlying data, we do expose a Data property in the event args.
https://es.infragistics.com/help/wpf/infragisticswpf.controls.menus.xamdatatree~infragistics.controls.menus.xamdatatree~nodedraggingstart_ev
Let me know if you have any questions.
So would you just alter the Data property on the dragsource then? It doesn't appear that the Data property on the droptarget is available until after the drop is actually made. If the change is made on the dragsource, how do we ensure that it doesn't change unless an actual drop is made? I want to be sure that the Data item is changed on a drop, but only IF a drop is made.
I've given this a try, but the problem with hooking up a mouse up event is that mouse up events actually fire prior to the drop taking place (the mouse up event fires prior to the drop event). So that doesn't help at all. Any other ideas on this?
You should hook a mouse up event. There isn't any built-in approach so what you can try is track when a item is moved by sending notifications (bool flags) based on your conditions and on mouse up check if the flag corresponds with whether or not the Data Item needs to be changed.