Skip to main content

GridColumn.AutoFilterValue Property

Gets or sets the value of the cell in the Auto Filter Row. This is a bindable property.

Namespace: DevExpress.Maui.DataGrid

Assembly: DevExpress.Maui.DataGrid.dll

NuGet Package: DevExpress.Maui.DataGrid

Declaration

public object AutoFilterValue { get; set; }

Property Value

Type Description
Object

A cell value.

Remarks

Enable the DataGridView.ShowAutoFilterRow option to display the auto filter row—a special row at the top of the grid that allows users to filter values in columns.

Data Grid - Auto Filter Row

The auto filter row allows users to filter values in all columns. You can use a column’s AllowAutoFilter property to disable this feature for an individual column.

Filter Mode

The DataGridView can format data field values before they are displayed in grid cells. For example, you can use the TextColumn.Mask property to specify a mask that restricts the user input and formats the output. The GridColumn.FilterMode property specifies whether filters are applied to actual data field values or to text displayed in cells. The filter mode may affect the default filter condition. See AutoFilterCondition for more information.

Specify Filter Values and Conditions in Code

A column’s AutoFilterValue property specifies the cell value in the auto filter row. The specified value is used to create a filer criterion based on the default filter condition (equals, contains, etc.), which depends on the type of the column. To use a specific condition, you can set the column’s AutoFilterCondition property to one of the following values:

  • Contains—values in the column should contain the criterion entered in the auto filter row.
  • Equals—values in the column should be equal to the criterion entered in the auto filter row.
  • Like—values in the column should start with the criterion entered in the auto filter row.

The ImmediateUpdateAutoFilter property specifies whether to filter data each time a value in the auto filter row is changed or only when a cell in the auto filter row loses focus.

The markup below enables the auto filter row in the grid, specifies the filter condition and initial filter for the first column, and prevents users from filtering values in the second column:

<dxg:DataGridView ItemsSource="{Binding Orders}"
                  ShowAutoFilterRow="True">
    <dxg:DataGridView.Columns>
        <dxg:TextColumn FieldName="Product.Name" Caption="Product" Width="150" 
                        AutoFilterCondition="Contains" AutoFilterValue="Ch"/>
        <dxg:NumberColumn FieldName="Product.UnitPrice" Caption="Price"
                          AllowAutoFilter="False"
                          DisplayFormat="C0" MinWidth="100"/>
        <dxg:NumberColumn FieldName="Quantity" MinWidth="100"/>
        <dxg:NumberColumn FieldName="Total" 
                          UnboundType="Integer" UnboundExpression="[Quantity] * [Product.UnitPrice]"
                          IsReadOnly="True" DisplayFormat="C0" MinWidth="100"/>
        <dxg:CheckBoxColumn FieldName="Shipped" MinWidth="100"/>
    </dxg:DataGridView.Columns>
</dxg:DataGridView>

The AutoFilterRowHandle property returns the handle of the auto filter row. You can use this handle to identify the row. For example, you can pass this handle to the SetCellValue or GetCellValue method to get or set a cell value in code.

Auto Filter Row Appearance

The following table lists properties that allow you to customize auto filter row appearance:

Property

Description

DataGridView.ShowFilterIcon
GridColumn.ShowFilterIcon

Specify whether to show filter icons in cells of the auto filter row.

FilterIconColor

Specifies the color of filter icons displayed in cells of the auto filter row.

AutoFilterRowHeight

Specifies the height of the auto filter row.

See Also