New to Telerik UI for .NET MAUI? Start a free 30-day trial

.NET MAUI DataGrid Empty Template

The .NET MAUI DataGrid control provides the ability to specify a template when the ItemsSource is null or collection is empty.

It exposes the following properties:

  • EmptyContentTemplate(DataTemplate)—Defines the content of the view which is shown when in the view has no items.

  • EmptyContentDisplayMode—Defines the modes for displaying empty content. The property have two modes:

    • ItemsSourceNull—Displays the empty content view only when the ItemsSource is null.
    • ItemsSourceNullOrEmpty—Displays the empty content view when ItemsSource is null or when the source is empty(has zero items).


1. Add DataGrid definition in XAML:

<telerik:RadDataGrid x:Name="dataGrid"
                     EmptyContentTemplate="{StaticResource EmptyContentTemplate}"/>

2. Add DataTemplate Resources:

    <DataTemplate x:Key="EmptyContentTemplate">
        <Label Margin="10" TextColor="Black" HorizontalOptions="Center" Text="No data to display"/>

See Also

In this article