Advertisement
Beginner .NET MAUI, Controls & Views

How do you display a scrollable list of items?

Short answer

Use CollectionView, MAUI's performant, virtualized list control. Bind ItemsSource to a collection and define an ItemTemplate with a DataTemplate. CollectionView supports linear and grid layouts, grouping, selection modes, and empty views, and replaces the older, heavier ListView.

Save .NET MAUI mock interview
Advertisement
AModel answer
Use CollectionView, MAUI's performant, virtualized list control. Bind ItemsSource to a collection and define an ItemTemplate with a DataTemplate. CollectionView supports linear and grid layouts, grouping, selection modes, and empty views, and replaces the older, heavier ListView.
<CollectionView ItemsSource="{Binding Items}">
    <CollectionView.ItemTemplate>
        <DataTemplate>
            <Label Text="{Binding Name}" Padding="12" />
        </DataTemplate>
    </CollectionView.ItemTemplate>
</CollectionView>
Real-world example
A product catalog binds 5,000 items to a CollectionView that scrolls smoothly thanks to UI virtualization.
Likely follow-ups
  • Why prefer CollectionView over ListView? | How do you template items?
Related topics