Articles in this section
Category / Section

How to display items with multiple columns in the xamarin.forms listview?

1 min read

ListView supports to display the items in both linear and grid layouts. By using the grid layout with predefined columns count using the SpanCount property, you can display the items in the listview.

xaml

<ContentPage xmlns:syncfusion="clr-namespace:Syncfusion.ListView.XForms;assembly=Syncfusion.SfListView.XForms"
             xmlns:data="clr-namespace:Syncfusion.DataSource;assembly=Syncfusion.DataSource.Portable">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="40"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid>
            <Label Text="Photos"/>
        </Grid>
        <syncfusion:SfListView x:Name="listView" 
                               ItemsSource="{Binding Gallerynfo}"
                               ItemSize="150">
            <syncfusion:SfListView.LayoutManager>
                <syncfusion:GridLayout SpanCount="2"/>
            </syncfusion:SfListView.LayoutManager>
            <syncfusion:SfListView.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Image Source="{Binding Image}" 
                           Aspect="AspectFill"/>
                        <Label LineBreakMode="NoWrap"
                           Text="{Binding ImageTitle}"/>
                    </Grid>
                </DataTemplate>
            </syncfusion:SfListView.ItemTemplate>
        </syncfusion:SfListView>
    </Grid>
</ContentPage>

 

Output:

 

Sample: Multiple columns in listview

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied