Articles in this section
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

Sorting records added at run time

UG Reference link

https://help.syncfusion.com/xamarin/datagrid/data-binding#livedataupdatemode

 

Sample Link

How to apply sorting for the new items added in SfDataGrid

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