How to filter the records with searching when underlying items source is DataTable in WPF DataGrid (SfDataGrid)?
The filtering is not work in the search operation while binding a DataTable to the WPF DataGrid (SfDataGrid). So, you need to convert the DataTable into Dynamic collection to filter the records while searching.
C#:
private DataTable dataTableCollection; //Gets the data for DataTable object. dataTableCollection = GetGridData(); //Convert DataTable collection as Dyanamic collection. var dynamicCollection = new ObservableCollection<dynamic>(); foreach (DataRow row in dataTableCollection.Rows) { dynamic dyn = new ExpandoObject(); dynamicCollection.Add(dyn); foreach (DataColumn column in dataTableCollection.Columns) { var dic = (IDictionary<string, object>)dyn; dic[column.ColumnName] = row[column]; } } DynamicOrders = dynamicCollection;
Conclusion
I hope you enjoyed learning about how to filter the records with searching when underlying items source is DataTable in WPF DataGrid (SfDataGrid).
You can refer to our WPF Grid feature tour page to know about its other groundbreaking feature representations. You can also explore our WPF Grid documentation 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!