Skip to content

SyncfusionExamples/How-to-access-filtered-records-from-winui-datagrid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

How to access filtered records from WinUI DataGrid?

About the sample

This example describes how to access filtered records from WinUI DataGrid.

In WinUI DataGrid (SfDataGrid), the records visible to the user were present in the SfDataGrid.View.Records property. When the filter is applied, the SfDataGrid.View.Records property can be used to get the filtered records. The FilterChanged event occurs whenever the filter is changed. Thus, by using this event, the filtered records can be accessed in DataGrid. The following code example demonstrates how to get the filtered records by the FilterChanged event.

this.dataGrid.FilterChanged += OnFilterChanged;

private void OnFilterChanged(object sender, Syncfusion.UI.Xaml.DataGrid.GridFilterEventArgs e)
{
     var filteredResult = this.dataGrid.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, the filtered records can be accessed in the underlying type.

Take a moment to peruse the WinUI DataGrid - Filtering documentation, where you can find about filtering with code examples.

Requirements to run the demo

Visual Studio 2019 and above versions

About

This example describes how to access filtered records from winui datagrid.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages