Load On Demand

In specific cases you may need to load data in the RadDataGrid when the control is already displayed as this can improve the performance and save computing resources. Loading a large data set on a mobile device has its challenges. One of the most popular approaches is using incremental data loading in the moment the items need to be visualized.


RadDataGrid offers two loading modes which are present in the LoadOnDemandMode enumeration:

  • Automatic: The load-on-demand mechanism is activated when you scroll down near the last item present in the view port.

You can control when the items will start loading more precisely by setting the LoadOnDemandBufferItemsCount property. It indicates at what point the additional items will start loading. For example, setting it to 20 will cause the new items to be loaded when you have scrolled the RadDataGrid so that only 20 of the originally loaded items are left below.

  • Manual: A "Load More" button is present at the bottom of the RadDataGrid. Clicking it will load additional items based on the approach you have chosen for loading the items(through the event, the command or the collection).


There are three different options for using the load-on-demand feature. You can choose the most convenient for you based on your application requirements:


In order to use this approach, you should feed the RadDataGrid with a collection of type LoadOnDemandCollection. It is a generic type, so you need to point the type of objects it will contain. It extends the ObservableCollection class and expects a Func in the constructor. Here is a simple setup that shows how to use the collection:

this.Items = new LoadOnDemandCollection<Person>((cancelationToken) =>
    var list = new List<Person>();
    for (int i = 0; i < 10; i++)
        var person = new Person { Name = "LOD Person " + i, Age = i + 18, Gender = i % 2 == 0 ? Gender.Male : Gender.Female };

    return list;

where the Items property is declared as follows:

public LoadOnDemandCollection<Person> Items { get; set; }

LoadOnDemand Event

You can load new items by utilizing the LoadOnDemand event. It uses LoadOnDemandEventArgs arguments through which you need to indicate when the data is loaded so that the event is correctly fired afterwards. Here is an example:

private void dataGrid_LoadOnDemand(object sender, Telerik.XamarinForms.DataGrid.LoadOnDemandEventArgs e)
    for (int i = 0; i < 15; i++)
        ((sender as RadDataGrid).ItemsSource as ObservableCollection<Person>).Add(new Person() { Name = "Person " + i, Age = i + 18, Gender = i % 2 == 0 ? Gender.Male : Gender.Female });
    e.IsDataLoaded = true;

LoadMoreData Command

The LoadMoreData command is another alternative which you can use which is suitable for MVVM scenarios. Here is how you can create such a command:

public class CustomLoadMoreDataCommand : DataGridCommand
    public CustomLoadMoreDataCommand()
        this.Id = DataGridCommandId.LoadMoreData;

    public override bool CanExecute(object parameter)
        return true;

    public async override void Execute(object parameter)
        if (parameter == null)


        await System.Threading.Tasks.Task.Delay(1500);
        var viewModel = this.Owner.BindingContext as LoadMoreDataCommandViewModel;
        if (viewModel != null)
            for (int i = 0; i < 10; i++)
                viewModel.Items.Add(new Person { Name = "Person " + i, Age = i + 18, Gender = i % 2 == 0 ? Gender.Male : Gender.Female });

Eventually, you need to add this custom command to the Commands collection of the RadDataGrid.

this.dataGrid.Commands.Add(new CustomLoadMoreDataCommand());

Invoking the ShowLoadOnDemandLoadingIndicator and HideLoadOnDemandLoadingIndicators is a notable part as without calling these methods the BusyIndicator used for the functionality will not be visualized.


Besides the different approaches for loading the data, RadDataGrid exposes several mechanisms related to the styling of the functionality which you can use according to the approach you have chosen.


This property can be used to style the appearance of the row that contains the "Load More" button when the LoadOnDemandMode is Manual.

The custom style is of type DataGridLoadOnDemandRowStyle:

<telerikDataGrid:DataGridLoadOnDemandRowStyle x:Key="CustomDataGridLoadOnDemandRowStyle" 
                                              Text="Some Text"
                                              TextFontFamily="Times New Roman"/>

And you should set it to the LoadOnDemandRowStyle property of the RadDataGrid:

<telerikDataGrid:RadDataGrid x:Name="dataGrid" 
                             ItemsSource="{Binding Items}"
                             LoadOnDemandRowStyle="{StaticResource CustomDataGridLoadOnDemandRowStyle}"/>

Figure 2: The appearance of the row after setting the LoadOnDemandRowStyle


This property can be used to set the template of the row that contains the "Load More" button when the LoadOnDemandMode is Manual.

Here is a custom DataTemplate:

<DataTemplate x:Key="CustomLoadOnDemandRowTemplate">
    <Label Text="Load more from Template"
           IsEnabled="{Binding IsDataLoading}">
            <Trigger TargetType="Label"
                     Property="IsEnabled" Value="False">
                <Setter Property="BackgroundColor" Value="LightBlue" />

And how you set the property:

<telerikDataGrid:RadDataGrid x:Name="dataGrid"
                             ItemsSource="{Binding Items}"
                             LoadOnDemandRowTemplate="{StaticResource CustomLoadOnDemandRowTemplate}"/>

Figure 3: The appearance of the row after setting the LoadOnDemandRowTemplate

See Also

In this article
Not finding the help you need?