Skip to content

CollectionView vertical scroll bar overlapping content #32355

@nk-alex

Description

@nk-alex

Description

I'm using a CollectionView defined as this:

<CollectionView Grid.Row="1" Background="Transparent" Margin="10"
      ItemsSource="{Binding CartArticles}" VerticalScrollBarVisibility="Always" SelectionMode="None">

  <CollectionView.ItemTemplate>
    <DataTemplate x:DataType="models:ArticleBinding">
      <Grid Margin="0, 5" HeightRequest="50" ColumnSpacing="5">
        <Grid.RowDefinitions>
          <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="*"/>
          <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>

        <Label Grid.Row="0" Grid.Column="0" TextColor="White" Text="{Binding Article}"
               HorizontalTextAlignment="Start"/>

        <Label Grid.Row="0" Grid.Column="1" TextColor="White" Text="{Binding Total}" 
                HorizontalTextAlignment="End"/>
      </Grid>
    </DataTemplate>
  </CollectionView.ItemTemplate>
</CollectionView>

On WinUI, the scrollBar overlaps the items on the CollectionView:
Image

On Android I could use handlers to set the scrollBarStyle: handler.PlatformView.ScrollBarStyle = Android.Views.ScrollbarStyles.InsideOverlay;, but on Windows, the only workaround I found is to set padding to the CollectionView: handler.PlatformView.Padding = new Microsoft.UI.Xaml.Thickness(0, 0, 20, 0); which just pushes items away from scroll bar.

Is there anyway to achieve in Windows the same functionality as Android.Views.ScrollbarStyles.OutsideOverlay (The scrollbar style to display the scrollbars at the edge of the view, without increasing the padding.) on Android?

Steps to Reproduce

Link to public reproduction project repository

No response

Version with bug

10.0.0-rc.2

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

net9.0-windows10.0.19041.0

Did you find any workaround?

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-collectionviewCollectionView, CarouselView, IndicatorViewplatform/windowss/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions