1

I'm having an hard time trying to figure how to do this. I want to handle the drag and drop from windows explore to my wpf application. It works fine, except for one thing.

I don't know how to handle the cancelling of the drag and drop.

In a normal way I would have a QueryContinueDrag event that occurs on my DragSource and tells me if the Escap key is pressed. But since I don't start the drag and drop operation, I don't have a drag source, and therefor no QuerContinueDrag event, so I can't clean my drap and drop operation (like removing the D&D adorner...).

I'v already try to fake a DragSource, but it's not working since the Events occurs on the element on which the drag and drop operation started (DragDrop.DoDragDrop...).

So if you have any idea :)

StrAbZ
  • 579
  • 1
  • 8
  • 24
  • 1
    You say "i can't clean my d'n'd operation?" Well it wasn't yours anyway, how did you create what you now want to clean in the first place? You have the DragEnter and DragLeave events, aren't these enough? – dowhilefor Jan 05 '12 at 13:09
  • I know I don't have created the DragDrop operation, but in the Drag* methods I show an Adorner that represents the file being drag, but when the user presses Escape, I have no event that can allow me to remove it. – StrAbZ Jan 05 '12 at 13:14
  • So no last DragLeave event is fired? – dowhilefor Jan 05 '12 at 13:28
  • While looking for your problem i also found this [thread](http://stackoverflow.com/questions/5447301/wpf-drag-drop-when-does-dragleave-fire) which might help. – dowhilefor Jan 05 '12 at 13:30
  • You where right, there is a last DragLeave event. I did not see it. I receive it when the d&d is cancelled. – StrAbZ Jan 05 '12 at 13:36

0 Answers0