Suppose I have a window with a custom UserControl, and the UserControl has a textbox inside. When I drag the window around, how can the TextBox detect that it is being moved ?
I tried to search around its RenderTransform property, there is that Change event that gets fired when "the Freezable object or one of its objects change". Nothing conclusive..
Edit :
In my case, I don't see the window, all I see is the UserControl and I can't go any higher.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With