How to detect that a control is being moved? How to detect that a control is being moved? wpf wpf

How to detect that a control is being moved?


You will need to subscribe to the Window events, as your textbox is not actually moving (its most likely in the same position relevant to the window) so you can subscribe to the Window.LocationChanged event to be notified when the window is moved.

But Also If your control does not have an absolute position then you will need to parse Window.SizeChanged which will tell you when the user has resized the window, but it’s a discrete final event as opposed to an in-progress event.


Try subscribing to the LayoutUpdated event of the UserControl.