Skip to content

Conversation

@martinflorek
Copy link

What does the pull request do?

ScrollViewer now honors padding when measuring its children. Should fix #17158. The bug looks to be in the ScrollContentPresenter, not the ScrollViewer itself.

I am not 100% sure if this is all that is needed to fix the ScrollViewer with padding scrolling issue. This is my first look at Avalonia source code.

What is the current behavior?

Currently the ScrollViewer ignores its padding when measuring its children. And in case when it cannot scroll horizontally or vertically, it is unable to scroll to the very end, see #17158

What is the updated/expected behavior with this PR?

ScrollViewer should use its padding to limit the available size when measuring its children.

Checklist

Breaking changes

Probably none, because the current behaviour is broken and ScrollViewer cannot be scrolled to the very end.

Fixed issues

Fixes #17158
Fixes #12182

@avaloniaui-bot
Copy link

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

@cla-avalonia
Copy link
Collaborator

cla-avalonia commented Nov 10, 2025

  • All contributors have signed the CLA.

@martinflorek
Copy link
Author

@cla-avalonia agree

@martinflorek
Copy link
Author

I tested the build 12.0.999-cibuild0059920-alpha and is not fully fixed. Measuring is now good, but there is still problem with the scrolling to the very end. I will dig deeper into this and update the PR.

@martinflorek
Copy link
Author

The problem in ScrollContentPresenter is just one part. There looks to be another problem with the ScrollViewer itself, where it incorrectly computes its Extent and Viewport properties without Padding, and may even more.

I am unable to create a ScrollViewer unit test, that will trigger all the measuring/layout code down to ScrollContentPresenter, so I will get Extent, Viewport and child size computed like in real application. Can someone help me with this please?

Another issue I started thinking about is: what does a padding in a scrolling view mean in general? Personally I want the "padding to scroll with the content", but some will probably expect a fixed padding like in other views i.e., fixed inset "frame" around the content, that scrolls within it. Maybe a scrolling view should not have a padding property at all? @timunie @trashhacker ?

@timunie
Copy link
Collaborator

timunie commented Nov 12, 2025

The team will review the PR once we have enough capacity for it.

About the last question: would be interesting to evaluate what other frameworks like WPF do about the padding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-candidate-11.3.x Consider this PR for backporting to 11.3 branch bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ScrollViewer not scrolling to end with bottom padding... ScrollViewer with Padding cut content and not scrollable to end

5 participants