How To Use Xamarin.Forms Listview In Xamarin.Android And Xamarin.Ios Platforms

Sample date Updated on Sep 24, 2025
listview native-app xamarin xamarin-listview

This example demonstrates how to use Xamarin.Forms ListView in Xamarin.Android and Xamarin.iOS platforms.

Sample

<Grid>
    <listView:SfListView x:Name="listView" ItemSpacing="10"
                         ItemsSource="{Binding contactsinfo}">
        <listView:SfListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <ViewCell.View>
                        <Grid x:Name="grid" RowSpacing="1">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="1" />
                            </Grid.RowDefinitions>
                            <Grid RowSpacing="1">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="70" />
                                </Grid.ColumnDefinitions>
                                    <Label 
                                        Text="{Binding ContactName}">
                                    </Label>
                                    <Label Grid.Row="1"
                                            Grid.Column="0"
                                            TextColor="#474747"
                                            LineBreakMode="NoWrap"
                                            Text="{Binding ContactNumber}">
                                    </Label>
                                </Grid>
                                <Grid Grid.Row="0"
                                        Grid.Column="1"
                                        RowSpacing="0"
                                        HorizontalOptions="End"
                                        Padding="0,10,10,0">
                                    <Label LineBreakMode="NoWrap"
                                            TextColor="#474747"
                                            Text="{Binding ContactType}">
                                    </Label>
                                </Grid>
                            </Grid>
                            <StackLayout Grid.Row="1" BackgroundColor="Gray" HeightRequest="1"/>
                        </Grid>
                    </ViewCell.View>
                </ViewCell>
            </DataTemplate>
        </listView:SfListView.ItemTemplate>
    </listView:SfListView>
</Grid>

See How to use Xamarin.Forms ListView in Xamarin.Android and Xamarin.iOS platforms for more details.

Requirements to run the demo

Troubleshooting

Path too long exception

If you are facing path too long exception when building this example project, close Visual Studio and rename the repository to short and build the project.

Up arrow