| Visual Basic (Declaration) | |
|---|---|
Public Property AutoFilterMode As AutoFilterMode | |
| C# | |
|---|---|
public AutoFilterMode AutoFilterMode {get; set;} | |
Return Value
An AutoFilterMode value indicating how automatic filter of the data items will be performed. By default, None indicating that no automatic filtering will be used.
| Member | Description |
|---|---|
| None | The data items will not be filtered. |
| And | The data items will be filtered according to all the filtering criteria defined by each column. If a data item matches all the criteria, it will be included. |
| Or | The data items will be filtered according to at least one of the filtering criteria defined by the columns. If a data item matches at least one criteria, it will be included. |
All examples in this topic assume that the grid is bound to the Orders table of the Northwind database, unless stated otherwise.
The following example demonstrates how to enable automatic filtering, disabling it for the columns that will not support it and filtering the distinct values of the ShipCity column.
| XAML | Copy Code |
|---|---|
<Grid> | |
If a column does not need to support automatic filtering, it is recommended to set its corresponding DataGridItemProperty's CalculateDistinctValues or the DataGridCollectionViewSource's DefaultCalculateDistinctValues properties to false.
If a column displays a custom type, automatic filtering will not function properly for that column unless the type implements the IComparable interface.
Supported Frameworks: Microsoft .NET Framework version 3.5
Copy Code