Category / Section
How to access the filtered records from WPF SfDataGrid?
2 mins read
SfDataGrid.View.Records contains the records in the View, which displays the records visible to the user. To get the filtered records, you have to access the SfDataGrid.View.Records when the filter is applied. The FilterChanged event occurs whenever the filter is changed. Thus, by using this event, you can access the filtered records in SfDataGrid. The following code example demonstrates how to get the filtered records by the FilterChanged event.
C#
this.sfGrid.FilterChanged += sfGrid_FilterChanged; void sfGrid_FilterChanged(object sender, Syncfusion.UI.Xaml.Grid.GridFilterEventArgs e) { var filteredResult = this.sfGrid.View.Records.Select(recordentry => recordentry.Data); }
The records in SfDataGrid.View.Records are of type RecordEntry that contain the underlying data. Thus by taking the recordentry.Data, you can get the filtered records in the underlying type.