Skip to content

Fix VirtualizingStackPanel ScrollToEnd with variable-sized items - #22014

Merged
MrJul merged 3 commits into
AvaloniaUI:mainfrom
zrt2399:fix_issue_22013
Aug 24, 2026
Merged

MrJul merged 3 commits into
AvaloniaUI:mainfrom
zrt2399:fix_issue_22013

Conversation

@zrt2399

@zrt2399 zrt2399 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

What does the pull request do?

Fixes VirtualizingStackPanel failing to scroll to the actual end when ScrollBar.ScrollToEnd() is called and trailing items have different sizes.

What is the current behavior?

bugdemo3

What is the updated/expected behavior with this PR?

bugdemo4

How was the solution implemented (if it's not obvious)?

When the viewport reaches the current panel end before all items have been
measured, VirtualizingStackPanel uses the last item as the realization anchor.
After measuring that item, its position is corrected using the actual size so
the extent and offset can be synchronized to the real end.

Checklist

Fixed issues

Fixes #22013

Keep the initial viewport before the variable-sized trailing items and exercise ScrollToEnd directly.
@avaloniaui-bot

Copy link
Copy Markdown

You can test this PR using the following package version. 12.2.999-cibuild0068475-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@MrJul MrJul added bug backport-candidate-12.1.x Consider this PR for backporting to 12.1 branch labels Aug 19, 2026
@avaloniaui-bot

Copy link
Copy Markdown

You can test this PR using the following package version. 12.2.999-cibuild0068669-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@MrJul
MrJul enabled auto-merge August 24, 2026 13:41
@MrJul
MrJul added this pull request to the merge queue Aug 24, 2026
Merged via the queue into AvaloniaUI:main with commit 7f8dd8e Aug 24, 2026
10 checks passed
MrJul pushed a commit to MrJul/Avalonia that referenced this pull request Sep 2, 2026
…loniaUI#22014)

* Fix VirtualizingStackPanel ScrollToEnd with variable-sized items

* Refine VirtualizingStackPanel ScrollToEnd regression test

Keep the initial viewport before the variable-sized trailing items and exercise ScrollToEnd directly.

---------

Co-authored-by: Emmanuel Hansen <emmausssss@gmail.com>
@MrJul MrJul added backported-12.1.x and removed backport-candidate-12.1.x Consider this PR for backporting to 12.1 branch labels Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ComboBox cannot scroll to the bottom with VirtualizingStackPanel when item heights vary

4 participants