Home > OS >  Collection view 4 images in a row
Collection view 4 images in a row

Time:12-11

Is it possible to make a collectionview with 4 images per row? Something like this: Example

Right now all of them are in one row:

            <CollectionView x:Name="galleryListView" ItemsSource="{Binding gallerylist}" WidthRequest="500">
                <CollectionView.ItemsLayout>
                     <GridItemsLayout Orientation="Horizontal"/>
                </CollectionView.ItemsLayout>
            <CollectionView.ItemTemplate>
                <DataTemplate>
                    <StackLayout WidthRequest="100">

                        <Image Source="{Binding Image}" ></Image>
                         
                    </StackLayout>                    
                </DataTemplate>
            </CollectionView.ItemTemplate>
            </CollectionView>

CodePudding user response:

you need to specify how many columns per row

<GridItemsLayout Span="4" Orientation="Horizontal"/>

docs

  • Related