Articles in this section
Category / Section

How to load the background image in .NET MAUI ListView (SfListView)?

8 mins read

To apply a background image to the .NET MAUI ListView (SfListView), you can overlay the ListView on an image by placing both elements in the same grid cell. This gives the appearance of the ListView having a background image. 

XAML

Define your XAML layout with a Grid containing both an Image and SfListView. The grid allows these elements to overlap, achieving the desired background effect.

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="ListViewBackgroundImage.ListViewSample"
             Title="ListViewSample"
             xmlns:local="clr-namespace:ListViewBackgroundImage"
             xmlns:syncfusion="clr-namespace:Syncfusion.Maui.ListView;assembly=Syncfusion.Maui.ListView"
             BackgroundColor="White">

    <ContentPage.Content>
        <Grid>
            <!-- Background Image -->
            <Image Source="{Binding BackgroundImage}"
                   Aspect="AspectFill"
                   Opacity="0.5" /> <!-- Added opacity for better readability -->

            <!-- ListView -->
            <syncfusion:SfListView x:Name="listView"
                                   SelectionMode="None"
                                   Margin="5"
                                   ItemSize="70"
                                   ItemsSource="{Binding contactsinfo}">
                <syncfusion:SfListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <ViewCell.View>
                                <Grid x:Name="grid">
                                    <Label Text="{Binding ContactName}" 
                                           TextColor="White" 
                                           FontSize="18" 
                                           FontAttributes="Bold"/>
                                    <Label Text="{Binding ContactNumber}" 
                                           TextColor="White" 
                                           FontSize="14" 
                                           VerticalOptions="End"/>
                                </Grid>
                            </ViewCell.View>
                        </ViewCell>
                    </DataTemplate>
                </syncfusion:SfListView.ItemTemplate>
            </syncfusion:SfListView>
        </Grid>
    </ContentPage.Content>
</ContentPage>

Output


.NET MAUI for Android

Backgroundimage in .NET MAUI


Download the complete sample on GitHub.

Conclusion

I hope you enjoyed learning how to load a background image in the .NET MAUI ListView.

You can refer to our .NET MAUI ListView feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started with configuration specifications. Explore our .NET MAUI ListView example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, try our 30-day free trial to check out our other controls.

Please let us know in the comments section if you have any queries or require clarification. Contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

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