Hello Simon Stahl,
The TreeView uses the DragDrop manager internally, so that anything that you have come across for it will be helpful when you want to customize the drag-drop.
I believe that almost any business rule can be implemented just by handling the DropQuery event for TreeView, there should no need to get into the "internals" like the ShowBetweenItemsDragCue method.
This online example shows what handling of the DragDrop events can achieve:
Also I have attached to this reply a more specific example that shows how the TreeView's behavior can be modified by handling the DragDrop events.
As for your specific questions, we can look at it this from two angles:
1. How do you know if the mouse is above / below an item?
- You can use the item.TransformToVisual(null).Transform(new Point())
to get the absolute position of the top left point for the TreeViewItem. Then you need to know the header height of the item, you may go into calculating this as well, but for most purposes you can assume that it is 24 (the default MinHeight). Then you can use the e.Options.CurrentDragPoin
t to calculate whether the mouse is below, over or after an item.
2. How do you tell the DragCue where to appear?
The item that is passed as a parameter to the ShowBetweenItemsDragCue method will serve as a guiding point. Then depending on its DropPosition
property, the cue will appear bellow or above it.
Hopefully this will help you implement what you need. If you have questions, do come back to us.
All the best,
the Telerik team