I'm working on a class derived from the WPF Window
class that behaves as an application toolbar window called AppBarWindow
. I have been able to find various WinForms implementations, but no WPF implementations.
I've got a lot of the code working, but I need to know when the user starts dragging the window around the screen and when they stop, as the window's behavior will differ. The default WPF handling isn't quite right, so I've implemented my own Window Procedure and installed it using an HwndSource
object.
I've got this working in an application at work that does not have a non-client area. In that case, there's a LeftMouseButtonDown
event handler that sets a flag to true, then calls the DragMove
method which drags the window around. When that method returns, I set the flag to false. Everything works.
But I'm working now on a general class that won't use the DragMove
method. I can add another LeftMouseButtonDown
handler for the window, but I don't believe that will get called if the mouse is in the non-client area.
How am I going to detect that the user is dragging the window and when they've stopped in this case?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…