-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix horizontal ScrollToView in VirtualizingStackPanel in some cases #14419
Fix horizontal ScrollToView in VirtualizingStackPanel in some cases #14419
Conversation
You can test this PR using the following package version. |
I wonder if that also solves other virtualization scrolling issues, namely if items have different sizes. |
Probably not, as far as I understand other virtualization scrolling issues mostly come from incorrectly estimating items height, in result scroll offset is not correctly set. In my case, Y offset was correctly set (items have same heights), but X offset wasn't because Extent was not updated yet during first BringIntoView. This is kinda a chicken-and-egg problem - in order to update width extent, the scroll offset Y needs to be set. |
This fixes a case when elements have different widths and the BringIntoView wants to scroll horizontally due to custom TargetRect
62f6584
to
078d7e4
Compare
You can test this PR using the following package version. |
You can test this PR using the following package version. |
This fixes a case when elements have different widths and the BringIntoView wants to scroll horizontally due to custom TargetRect Co-authored-by: Max Katz <maxkatz6@outlook.com>
What does the pull request do?
This fixes a case when elements in VirtualizingStackPanel have different widths, ScrollToView is invoked with an element whose TargetRect in BringIntoView is out of bounds.
I am not sure if this is a big hack fix or an alright solution.
What is the current behavior?
In the BringToView ScrollViewer extents are still not updated and even thought the Offset is being set to the correct position, it is clamped to the old extents thus ScrollToView doesn't scroll to the element, see the video below:
Screen.Recording.2024-01-31.at.01.28.02.mov
What is the updated/expected behavior with this PR?
When calling BringIntoView again, the Y offset should be correct and ScrollViewer's extents should be correct, thus this call should scroll to the right horizontal position.
Checklist
Breaking changes
n/a
Obsoletions / Deprecations
n/a
Fixed issues
Fixes #14418