Handle Padding correctly in ScrollContentPresenter - #21872
Conversation
|
You can test this PR using the following package version. |
* Add failing ScrollViewer tests * Handle Padding correctly in ScrollContentPresenter
|
Hi @MrJul, thank you for the fix. Unlike WPF, where ScrollViewer.Padding is taken into account during scrolling, support for equivalent behavior is not included in this PR. Is this behavior expected? <Border Height="400"
BorderBrush="Gray"
BorderThickness="1">
<ScrollViewer Padding="20" VerticalScrollBarVisibility="Auto">
<Button Height="600">Button</Button>
</ScrollViewer>
</Border>
|
|
Yes, as mentioned in the PR:
WPF behavior: <Border Height="400"
BorderBrush="Gray"
BorderThickness="1">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<ScrollViewer.Styles>
<Style Selector="ScrollContentPresenter">
<Setter Property="Margin" Value="20" />
</Style>
</ScrollViewer.Styles>
<Button Height="600">Button</Button>
</ScrollViewer>
</Border> |
Thanks for clarifying. |


What does the pull request do?
This PR ensures that the
Padding(and theBorderThickness)of aScrollContentPresenteris correctly taken into account when measuring or arranging its content.What is the current behavior?
The padding in a direction that contains a scrollbar is ignored, and the content can't scroll to its end.
What is the updated/expected behavior with this PR?
The padding is correctly taken into account and is visible. The content is scrolled correctly.
Notes
Note that contrary to WPF, the padding is inside the scrolling area (matching WinUI). It was already the case before this PR, and changing that would be a behavioral breaking change. Users wanting the WPF behavior can simply set a
Marginon theScrollContentPresenterinstead.Fixed issues