microsoft-ui-xaml icon indicating copy to clipboard operation
microsoft-ui-xaml copied to clipboard

Padding on ItemsView clips items

Open tipa opened this issue 6 months ago • 0 comments

Describe the bug

I'm having a horizontal ItemsView that is scrollable. I want the items inset horizontally by 8 points so that they don't hug the window border. But when they are scrolled out of the view, the items should not clip at that 8 point padding, they should expand beyond the padding, and only clip at window edge. This works as expected when using ListView and a horizontal ItemsStackPanel

Steps to reproduce the bug

<ItemsView x:Name="itemsView" ItemsSource="{x:Bind data}" Padding="8,0">
    <ItemsView.Layout>
        <StackLayout Orientation="Horizontal" Spacing="4" />
    </ItemsView.Layout>
    <ItemsView.ItemTemplate>
        <DataTemplate>
            <ItemContainer Height="100" Width="100">
                <Rectangle Fill="Red"/>
            </ItemContainer>
        </DataTemplate>
    </ItemsView.ItemTemplate>
</ItemsView>

Example project: test.zip

Expected behavior

The ItemsView does not clip its items at the padding specified

Screenshots

Image

NuGet package version

WinUI 3 - Windows App SDK 1.8 Experimental 1: 1.8.250515001-experimental2

Windows version

Windows 11 (24H2): Build 26100

Additional context

No response

tipa avatar Jun 17 '25 12:06 tipa