I am working on a class derived from the WPF Window class, which behaves like an application toolbar window called AppBarWindow . I was able to find various implementations of WinForms, but not WPF implementations.
I have a lot of work with the code, but I need to know when the user starts to drag the window around the screen and when it stops, as the behavior of the window will be different. WPF handling by default is not entirely correct, so I applied my own Window procedure and set it using the HwndSource object.
It works for me in the application at work, which does not have a non-client area. In this case, there is a LeftMouseButtonDown event handler that sets the flag to true, then calls the DragMove method, which drags the window around. When this method returns, I set the flag to false. Everything works.
But now I'm working on a generic class that will not use the DragMove method. I can add another LeftMouseButtonDown handler for the window, but I donβt think it will be called if the mouse is in a non-client area.
How do I know if a user is dragging a window and when did it stop in this case?
source share