How to display an animation while loading the data in the SfDataGrid?
An animation can be displayed when loading a SfDataGrid by adding an ActivityIndicator inside the layout containing SfDataGrid in the GridLoaded event.
Refer the below code example in which an activity indicator is used to display an animation when the grid is loaded.
<Grid x:Name="grid" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"> <sfGrid:SfDataGrid x:Name="dataGrid" AutoGenerateColumns="True" ColumnSizer="Star" GridLoaded="DataGrid_GridLoaded" ItemsSource="{Binding OrdersInfo}"> </sfGrid:SfDataGrid> </Grid>
private async void DataGrid_GridLoaded(object sender, GridLoadedEventArgs e) { ActivityIndicator indicator = new ActivityIndicator(); indicator.IsRunning = true; indicator.IsVisible = true; indicator.Color = Color.Black; grid.Children.Add(indicator); await Task.Delay(3000); indicator.IsRunning = false; indicator.IsVisible = false; viewModel.SetRowstoGenerate(100); }
Screenshot
Sample Link
How to display an animation while loading the data in the SfDataGrid?
Conclusion
I hope you enjoyed learning about how to display an animation while loading the data in the SfDataGrid.
You can refer to our Xamarin.Forms DataGrid feature tour page to know about its other groundbreaking feature representations. You can also explore our Xamarin.Forms DataGrid documentation 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, 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 forums, Direct-Trac, or feedback portal. We are always happy to assist you!