Determining DragOver Source Control?

  • Thread starter Thread starter Gary Brown
  • Start date Start date
G

Gary Brown

Hi,

I need to prohibit a drag/drop where the source and destination
are the same. To do this the DragOver event handler needs to
know it you are dragging over the control where the drag
originated or a possible drop destination. How? In this case
both source and destination are ListView and use the same
code for drag/drop.

I am using
if (ReferenceEquals(SourceControl, SendingControl))
e.Effect = DragDropEffects.None;
else
e.Effect = e.AllowedEffect;


Thanks,
Gary
 
I need to prohibit a drag/drop where the source and destination
are the same. To do this the DragOver event handler needs to

FWIW: I solved the problem myself. There does not appear to be
any hint of where dragged items come from in any of the event
information.

The solution was to give each control an ID which is prepended to
dragged data. I use the time the control is created, in milliseconds,
for the ID.

Testing the "sender' against the control the item is being dragged
over didn't work because sender isn't the "sender" of the item - it
is the control.

Gary
 
Back
Top