Repository navigation
Fix VirtualizingStackPanel offset when scrolling to variable-sized items - #21975
Conversation
|
You can test this PR using the following package version. |
grokys
left a comment
There was a problem hiding this comment.
LGTM, other than a small nit! (I can happily remove the parameter myself if you'd like)
# Conflicts: # src/Avalonia.Controls/VirtualizingStackPanel.cs
grokys
left a comment
There was a problem hiding this comment.
Removed the parameter. LGTM now.
|
FYI, |
Change the the test to check that the element is outside of the viewport, instead of asserting its exact coordinates - that's the important part.
|
Looks like we had a test that was asserting exact coordinates that started failing. Tweaked the test to just check what is important: that the element is not in the viewport. |
|
You can test this PR using the following package version. |
Azure Pipelines never queued a build for 3d81ceb. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0169P8BipcMkn44hvhpQ2UNF
|
You can test this PR using the following package version. |
…ems (AvaloniaUI#21975) * Fix VirtualizingStackPanel offset when scrolling to variable-sized items * Remove the `isScrollIntoView` parameter. * Tweak now-failing test. Change the the test to check that the element is outside of the viewport, instead of asserting its exact coordinates - that's the important part. * Retrigger CI. Azure Pipelines never queued a build for 3d81ceb. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0169P8BipcMkn44hvhpQ2UNF --------- Co-authored-by: grokys <grokys@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
What does the pull request do?
Fixes incorrect
VirtualizingStackPaneloffsets whenScrollIntoViewtargets an unrealized item before the current realized range and the items have variable sizes.
This can occur, for example, when reopening a
ComboBoxwith a selected item in the middle of the list. The selected item may already appear at the top while the popup still has additional scrollable space above it.What is the current behavior?
What is the updated/expected behavior with this PR?
How was the solution implemented (if it's not obvious)?
GetOrEstimateElementUnow accepts anisScrollIntoViewparameter.For a preceding
ScrollIntoViewtarget, it interpolates between index0at the panel origin and the first realized item's known position. Other callers, such as positioning a retained focused container outside the realized range, continue using the existing average-size extrapolation behavior.Checklist
Fixed issues
Fixes #21971