Skip to content

[Windows] The horizontally oriented CollectionView does not correctly place the elements in the vertical plane #32543

@Nikita-181

Description

@Nikita-181

Description

Horizontally oriented CollectionView on Windows has non-existent padding for items.

Windows

Image

Android

Image

Steps to Reproduce

  1. Create a new project.
  2. Modify the MainPage.xaml file:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MauiApp1.MainPage">

    <Grid RowDefinitions="*,*,*">
        <BoxView Grid.Row="0" BackgroundColor="Black"/>
        <Grid Grid.Row="1" ColumnDefinitions="*,*,*">
            <CollectionView Grid.Column="0" Background="Transparent" SelectionMode="Single" HorizontalOptions="Center">
                <CollectionView.ItemsSource>
                    <x:Array Type="{x:Type x:String}">
                        <x:String>Item VerticalOptions="Start"</x:String>
                    </x:Array>
                </CollectionView.ItemsSource>
                <CollectionView.ItemsLayout>
                    <LinearItemsLayout Orientation="Horizontal" ItemSpacing="10" />
                </CollectionView.ItemsLayout>
                <CollectionView.ItemTemplate>
                    <DataTemplate>
                        <Label Text="{Binding}"  Background="Red" TextColor="White" HeightRequest="25" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" VerticalOptions="Start"/>
                    </DataTemplate>
                </CollectionView.ItemTemplate>
            </CollectionView>
            
            <CollectionView Grid.Column="1" Background="Transparent" SelectionMode="Single" HorizontalOptions="Center">
                <CollectionView.ItemsSource>
                    <x:Array Type="{x:Type x:String}">
                        <x:String>Item VerticalOptions="Center"</x:String>
                    </x:Array>
                </CollectionView.ItemsSource>
                <CollectionView.ItemsLayout>
                    <LinearItemsLayout Orientation="Horizontal" ItemSpacing="10" />
                </CollectionView.ItemsLayout>
                <CollectionView.ItemTemplate>
                    <DataTemplate>
                        <Label Text="{Binding}"  Background="Red" TextColor="White" HeightRequest="25" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" VerticalOptions="Center"/>
                    </DataTemplate>
                </CollectionView.ItemTemplate>
            </CollectionView>

            <CollectionView Grid.Column="2" Background="Transparent" SelectionMode="Single" HorizontalOptions="Center">
                <CollectionView.ItemsSource>
                    <x:Array Type="{x:Type x:String}">
                        <x:String>Item VerticalOptions="End"</x:String>
                    </x:Array>
                </CollectionView.ItemsSource>
                <CollectionView.ItemsLayout>
                    <LinearItemsLayout Orientation="Horizontal" ItemSpacing="10" />
                </CollectionView.ItemsLayout>
                <CollectionView.ItemTemplate>
                    <DataTemplate>
                        <Label Text="{Binding}"  Background="Red" TextColor="White" HeightRequest="25" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" VerticalOptions="End"/>
                    </DataTemplate>
                </CollectionView.ItemTemplate>
            </CollectionView>
        </Grid>
        <BoxView Grid.Row="2" BackgroundColor="Black"/>
    </Grid>
</ContentPage>
  1. Run the Windows application.

Link to public reproduction project repository

No response

Version with bug

9.0.111 SR11.1

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

Windows 10 22H2 19045.6456

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
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions