How to access the filtered records from WPF DataGrid?
WPF DataGrid 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.
Conclusion
I hope you enjoyed learning about how to access the filtered records from WPF SfDataGrid.
You can refer to our WPF DataGrid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WPF DataGrid example 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!