Articles in this section
Category / Section

How to improve performance when doing bulk changes in Xamarin.iOS DataGrid?

1 min read

The Xamarin DataGrid refreshes the view, whenever a new item is added or removed to its collection. Thus, when you perform a bulk changes continuously it may appear like the performance is affected as the grid is refreshed when each item is added or removed. In order to overcome this performance lag SfDataGrid allows you to suspend the updates and resume it to refresh the grid at once.

The SfDataGrid.View.BeginInit method suspends the view updates and the SfDataGrid.View.EndInit method resumes the updates and refreshes the grid.

dataGrid.AllowLoadMore = true;
dataGrid.LoadMoreCommand = new Command(ExecuteLoadMoreCommand);
 
public async void ExecuteLoadMoreCommand()
{
    dataGrid.IsBusy = true;
    await Task.Delay(5000);
    dataGrid.View.BeginInit();
    viewModel.LoadMoreItems();
    dataGrid.View.EndInit();
    dataGrid.IsBusy = false;
}
 
// ViewModel.cs
 
public void LoadMoreItems()
{
    for (int i = 1; i <= 50; i++)
    {
        Collection.Add(repository.CreateItem(Collection.Count + 1));
    }
}
 
// ModelRepository.cs
 
public Model CreateItem(int customerID)
{
    Model model = new Model();
    model.CustomerID = customerID;
    model.CustomerName = CustomerName[random.Next(10)];
    model.OrderID = random.Next(100, 500);
    model.ShipCountry = ShipCountry[random.Next(20)];
    return model;
}
 

 

Sample Link:

How to improve performance when doing bulk changes in SfDataGrid


Conclusion

I hope you enjoyed learning about how to improve performance when doing bulk changes in
DataGrid
.

You can refer to our Xamarin.iOS DataGrid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.

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

If you have any queries or require clarifications, please let us know in the comments section below. You can also 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 sign in to leave a comment
Access denied
Access denied