This repository has been archived by the owner on May 1, 2024. It is now read-only.
Fixed ScrollY when ItemsSource reloaded or row height changed #12053
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes two issues with ListView scroll event ScrollY value that were making it pretty unreliable and buggy.
Original code was commited in this commit
I'm not 100% sure if there can't be any other situation when the scroll fails to be tracked (maybe some fast scroll?), for which setting the
_contentOffset
to0
might not be correct, but it fixes the "reloaded ItemsSource" issue, which seems to be the most common. When we are not able to track the offset at all, it's a bug anyway, so setting the offset to 0 seems good because it solves this issue at least.Issues Resolved
API Changes
None
Platforms Affected
Behavioral/Visual Changes
ScrollY value in Scrolled event might sometimes be different than before, because it's now fixed.
Testing Procedure
I tested the sample project in #8305 and #9370 and confirmed it is fixed. However, it might be good to test that setting the
_contentOffset
to0
doesn't create any side effects in different situations.PR Checklist