How do I customize the appearance of the ListView items in .NET MAUI?

Platform: .NET MAUI| Category: Controls

To customize the appearance of ListView items define  a DataTemplate, which allows you to specify the layout and appearance of each item.

XAML

<ListView ItemsSource="{Binding MyItems}">
      <ListView.ItemTemplate>
          <DataTemplate>
              <!-- Customize the appearance of each ListView item here -->
              <ViewCell>
                  <StackLayout Padding="10">
                      <Label Text="{Binding}" FontSize="18" TextColor="Black" />
                      <Image Source="icon.png" HeightRequest="30" WidthRequest="30"/>
                  </StackLayout>
              </ViewCell>
          </DataTemplate>
      </ListView.ItemTemplate>
  </ListView>

Share with

Related FAQs

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

Please submit your question and answer.