Skip to main content

GridControl.CustomRowFilter Event

Allows you to use custom rules to filter data rows.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v23.1.dll

NuGet Package: DevExpress.Wpf.Grid.Core


public event RowFilterEventHandler CustomRowFilter

Event Data

The CustomRowFilter event's data class is DevExpress.Xpf.Grid.RowFilterEventArgs.


Use the CustomRowFilter event to apply a custom filter condition. The custom filter takes priority over the filter criteria applied in a column’s Drop-down Filter or the Automatic Filter Row.

To apply a custom filter condition, handle the CustomRowFilter event. The GridControl raises this event for each record in a data source. The ListSourceRowIndex property returns the row’s data source index.

To hide or show a row, specify the Visible property, and set the Handled property to true.

If the Handled property is set to false, the filter applied to the GridControl determines the row’s visibility.


The CustomRowFilter event does not work in Server Mode.

If you want to maintain a clean MVVM pattern and specify custom filter rules in a View Model, create a command and bind it to the CustomRowFilterCommand property.

Refer to the following help topic for more information: Filtering and Searching.


The following example demonstrates how to apply a custom filter condition to the GridControl:

DevExpress WPF | Grid Control - Custom Filter Rules

View Example: How to Apply a Custom Filter Condition

        <RowDefinition Height="36" />
        <RowDefinition Height="*" />
    <StackPanel Grid.Row="0" Orientation="Horizontal">
        <CheckBox Name="chkHideEven"
                  Content="Hide Even Rows"
                  Unchecked="OnCheckedChanged" />
        <CheckBox Name="chkHideOdd"
                  Content="Hide Odd Rows"
                  Unchecked="OnCheckedChanged" />
    <dxg:GridControl Name="grid"
            <dxg:TableView Name="view"
                           NavigationStyle="None" />
void OnCustomRowFilter(object sender, RowFilterEventArgs e) {
    if(chkHideOdd.IsChecked.Value && e.ListSourceRowIndex % 2 == 1)
        e.Visible = false;
    if(chkHideEven.IsChecked.Value && e.ListSourceRowIndex % 2 == 0)
        e.Visible = false;
    e.Handled = !e.Visible ? true : false;

void OnCheckedChanged(object sender, RoutedEventArgs e) {

The following code snippets (auto-collected from DevExpress Examples) contain references to the CustomRowFilter event.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also