Determining DragOver Source Control?

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
 
G

Gary Brown

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top