I have some custom calculations that changes the dimensions of a control based on the dimensions of a ScrollViewer's viewport. Currently, I make these calculations when getting a ScrollViewer.SizeChanged event. However, it seems like the SizeChanged event executes before the ScrollViewer updates the ViewPort dimensions. My event handler for SizeChanged shows a ScrollViewer sender with the Width and Height updated to the new dimensions but the ViewportWidth and ViewportHeight properties are of the old dimensions.
Is there a way to execute code once those values change?
According to MSDN you check the ScrollViewer's ScrollChanged
event. When it fires, it means the viewportwidth or viewportheight has changed.
OnScrollChanged Called when a change in scrolling state is detected, such as a change in scroll position, extent, or viewport size.
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