xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.62k stars 1.87k forks source link

[Bug] [iOS] Horizontal Collection View Item Spacing Hiding Items #7605

Open paul-charlton opened 5 years ago

paul-charlton commented 5 years ago

Description

When using a horizontal orientated collection view with an item spacing then some items are hidden.

Steps to Reproduce

  1. Use Xaml below, AList is a string[6]
  2. Run, 3 items are shown
  3. Remove ItemSpacing, rerun and 6 items are shown

            <CollectionView ItemsSource="{Binding AList}">
    
                <CollectionView.ItemsLayout>
                    <ListItemsLayout ItemSpacing="15" Orientation="Horizontal" />
                </CollectionView.ItemsLayout>
    
                <CollectionView.ItemTemplate>
                    <DataTemplate>
    
                        <Label Text="O" TextColor="Blue" />
    
                    </DataTemplate>
                </CollectionView.ItemTemplate>
    
            </CollectionView>

Expected Behavior

6 items always shown

Actual Behavior

only 3 shown (changing the items spacing effects the number of items)

Basic Information

Screenshots

will provide if needed

Reproduction Link

will provide if needed

adrianknight89 commented 5 years ago

@paul-charlton It'd be easier for the team if you could attach a repro.

StephaneDelcroix commented 5 years ago

Reproduction Link

will provide if needed

most definitely needed

StephaneDelcroix commented 5 years ago

/cc @hartez @rmarinho

paul-charlton commented 5 years ago

there's a branch here that shows the problem. The top collection view only shows 3 items, the second one (which is working) shows 6.

https://github.com/paul-charlton/IssueSandbox/tree/XF_7605

paul-charlton commented 5 years ago

the same issue seems to occur if you use a gridlayout with spacing as well: <GridItemsLayout HorizontalItemSpacing="15" Orientation="Horizontal" Span="1" />

PureWeen commented 5 years ago

possibly related https://github.com/xamarin/Xamarin.Forms/issues/7309

winterdouglas commented 4 years ago

Facing this issue here in my horizontal list with item spacing. If I remove the spacing that works nicely.

AbdellahMobiArchitects commented 4 years ago

I'm facing this issue as well, removing the ItemSpacing fixes it

winterdouglas commented 4 years ago

Any updates on this one?

activa commented 4 years ago

This is still an issue. Can this get some love please?

hartez commented 3 years ago

Using the repro from https://github.com/xamarin/Xamarin.Forms/issues/7605#issuecomment-534544044 and updating to 5.0.0.1931, the second example (horizontal grid layout with span of 1 and spacing of 15) now works. The first example (horizontal linear layout with spacing 15) is still broken.

JordiCasas commented 2 years ago

I also have this issue with a LinearITemsLayout and ItemSpacing set. The more elements I added to the collection the more elements where shown. So if I have 4 elements only 3 are shown but if I have 10, 6 are shown.

As @hartez noted, using a GridItemsLayout with a span of 1 row like @paul-charlton stated in a comment works as a workaround.

the same issue seems to occur if you use a gridlayout with spacing as well: <GridItemsLayout HorizontalItemSpacing="15" Orientation="Horizontal" Span="1" />