Category / Section
How to apply sorting for the new items added in Xamarin SfDataGrid?
1 min read
Sorting can be applied for the new item which is added in SfDataGrid by setting a LiveDataUpdateMode property in the SfDataGrid.View to AllowDataShaping in the GridLoaded event.
public MainPage() { InitializeComponent(); viewModel = new ViewModel(); dataGrid.ItemsSource = viewModel.OrdersInfo; dataGrid.AllowSorting = true; dataGrid.GridLoaded += DataGrid_GridLoaded; dataGrid.SortColumnDescriptions.Add(new SortColumnDescription() { ColumnName = "EmployeeID", SortDirection = ListSortDirection.Descending }); } private void DataGrid_GridLoaded(object sender, GridLoadedEventArgs e) { dataGrid.View.LiveDataUpdateMode = LiveDataUpdateMode.AllowDataShaping; }
Screenshot
UG Reference link
https://help.syncfusion.com/xamarin/datagrid/data-binding#livedataupdatemode
Sample Link