Category / Section
How to display an animation till the SfDataGrid is loading?
1 min read
SfDataGrid takes some time for its initial loading of data and it largely depends on the type and size of the bound data. Thus, you can load an animation in the meantime the grid is loading using an ActivityIndicator in the SfDataGrid.GridLoaded event.
Refer the below code in which an activity indicator is created and displayed until the SfDataGrid is loaded.
private async void DataGrid_GridLoaded(object sender, GridLoadedEventArgs e) { ActivityIndicator indicator = new ActivityIndicator(); indicator.BackgroundColor = Color.White; indicator.IsRunning = true; indicator.IsVisible = true; grid.Children.Add(indicator); await Task.Delay(5000); indicator.IsRunning = false; indicator.IsVisible = false; }
When the above code is executed, you can get the below output:
Sample Link:
How to display a busy indicator till the SfDataGrid is loading