S
SJD
Came across something today, just wondered what other people's views are.
Imagine a tree control with lots of nodes. You can drag/drop the nodes
on top of each other (obviously, you can't drag a parent node onto a
child, etc, basic rules apply).
With the standard drag/drop mechanism (provided by Control.DoDragDrop),
you'd expect the following sequence of events:
ItemDrag, DragOver (xN), DragDrop
In theory, in DragOver, you check the 'destination' to make sure it's
valid, and set e.Effects as appropriate (to DragDropEffects.None if the
destination is invalid).
I'd always assumed that you'd get AT LEAST 1 [DragOver] event, I was
wrong. You can just get:
ItemDrag, DragDrop
To me, this is weird. It means you have to duplicate the destination
checking logic within [DragDrop]. If you were always guaranteed at
least 1 [DragOver] event, you only need to call the logic once.
By using the Get DataObject, you could pass through the destination
object (if you have one) from the [DragOver] to [DragDrop] handlers/methods.
Any takes on this? Perhaps I'm just overcomplicating the issue.
Sean
Imagine a tree control with lots of nodes. You can drag/drop the nodes
on top of each other (obviously, you can't drag a parent node onto a
child, etc, basic rules apply).
With the standard drag/drop mechanism (provided by Control.DoDragDrop),
you'd expect the following sequence of events:
ItemDrag, DragOver (xN), DragDrop
In theory, in DragOver, you check the 'destination' to make sure it's
valid, and set e.Effects as appropriate (to DragDropEffects.None if the
destination is invalid).
I'd always assumed that you'd get AT LEAST 1 [DragOver] event, I was
wrong. You can just get:
ItemDrag, DragDrop
To me, this is weird. It means you have to duplicate the destination
checking logic within [DragDrop]. If you were always guaranteed at
least 1 [DragOver] event, you only need to call the logic once.
By using the Get DataObject, you could pass through the destination
object (if you have one) from the [DragOver] to [DragDrop] handlers/methods.
Any takes on this? Perhaps I'm just overcomplicating the issue.
Sean