WPF dragenter / dragleave problem

I am writing a WPF application with drag and drop support in the controls in the application, as well as drag and drop between my desktop file and my application. I use adorner to change my mouse cursor.

The internal dragdrop operation between controls is not a problem. The problem is drag and drop between the desktop file and my application.

I set the DragEnter and DragLeave handler for my window. When I drag and drop a file into my application, DragEnter starts, but it not only starts once, but also continues to shoot using DragLeave in the application window.

What I already achieve, I manage to drag the file into my application, with the desired adorner; but if I hold on to the mouse and drag the file back to the desktop, adorner just got stuck in the corner. I cannot clear adorner using DragLeave because the DragLeave event is fired non-stop when I drag the mouse into my application.

I want DragLeave to start only when the mouse cursor leaves my application.

Any workaround?

+3
source share
1 answer

Here is a possible workaround you can make for this scenario. DragDrop - DragEnter / DragLeave events continue to shoot

+1
source

Source: https://habr.com/ru/post/1783793/


All Articles