How do I know if a drag operation failed?

It seems to me that there is no way to determine if the drag operation was successful or not, but there must be some way. Suppose I want to make a "transition" from source to destination. If the user releases the mouse over some application or control that cannot accept the fall, how can I say?

In this regard, how can I find out when the drag and drop is completed at all?

I saw this question , but its solution does not work for me, and e.Action always Continue .

+4
source share
3 answers

I'm not sure this can help you, but the DoDragDrop method returns the final DragDropEffects value.

 var ret = DoDragDrop( ... ); if(ret == DragDropEffects.None) //not successfull else // etc. 
+6
source

And, I think, I have it. Turns off the DoDragDrop call, which is actually synchronous (like a lame one) and returns the DragDropEffects value, which is set to None if op does not work. So basically, this means that the application (or at least the UI thread) will be frozen as long as the user is in the middle of a drag and drop. This is not a very elegant solution for me.

Ok cz_dl I see that you just posted this, so I will give you an answer.

I do not understand this, though: how can the destination determine if op should be a move or a copy? Shouldn't it be in the original application?

+3
source

I can not add a comment, so another answer. I was also surprised to see for the first time that DoDragDrop is being called synchronously, and somehow it did not freeze the user interface.

But copying / moving things that I think is completely logical. You can specify the allowed effects when calling the DoDragDrop method in the source application and that’s all that matters to you. How the receiving application will process and use the data that it has for it.

0
source

All Articles