I have a treeview with drag-and-drop enabled that works fine for moving the nodes around.
Now I want to add the ability to copy nodes instead of moving them if the CTRL key is held down.
I can check the CTRL key like this
I use the above logic to differentiate if the backends MoveNode or CopyNode service method is to be called. This works fine and the data is consistent, but the TreeView control seems to automatically remove the source upon a successful drag and drop.
I can re-insert it if CTRL was down, but I'd rather not have to do that since I might not add to the same position as it was causing the source node to "jump" around.
Any way to tell the TreeView that this is a copy operation and not a move operation? Also I'd like a way for the visual cue to display a + sign or something similar when CTRL is down.
A note: This tree is two-way bound to a object so I don't have any specific Drag/Drop event handlers. The treeview modifies the object on drag-and-drop.
Now I want to add the ability to copy nodes instead of moving them if the CTRL key is held down.
I can check the CTRL key like this
ModifierKeys keys = Keyboard.Modifiers;
bool
controlKeyPressed = (keys & ModifierKeys.Control) != 0;
I use the above logic to differentiate if the backends MoveNode or CopyNode service method is to be called. This works fine and the data is consistent, but the TreeView control seems to automatically remove the source upon a successful drag and drop.
I can re-insert it if CTRL was down, but I'd rather not have to do that since I might not add to the same position as it was causing the source node to "jump" around.
Any way to tell the TreeView that this is a copy operation and not a move operation? Also I'd like a way for the visual cue to display a + sign or something similar when CTRL is down.
A note: This tree is two-way bound to a object so I don't have any specific Drag/Drop event handlers. The treeview modifies the object on drag-and-drop.