How do I populate a ListView in .NET MAUI?

Platform: .NET MAUI| Category: Controls

To populate a ListView, set its ItemsSource property to a collection of items, typically a list or an ObservableCollection. Each item represents one of the list’s entries. You can customize the appearance of each item in the ListView by assigning the DataTemplate within the ItemTemplate.

XAML

<ListView ItemsSource="{Binding Books}">
    <ListView.ItemTemplate>
        <DataTemplate>
            <TextCell Text="{Binding Title}"
          Detail="{Binding Description}" />
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.