Skip to main content

FilterBehavior.ActualFilterCriteriaChanged Event

Occurs when the filter criteria is changed.

Namespace: DevExpress.Xpf.Core.FilteringUI

Assembly: DevExpress.Xpf.Grid.v24.2.dll

NuGet Package: DevExpress.Wpf.Grid.Core

Declaration

public event EventHandler ActualFilterCriteriaChanged

Event Data

The ActualFilterCriteriaChanged event's data class is EventArgs.

Remarks

Run Demo: FilterBehavior - Server Data Filtering

The following code sample shows how to use the FilterBehavior to make the Filter Elements filter the ViewModel’s data.

<dxa:AccordionControl>
    <dxmvvm:Interaction.Behaviors>
        <dxfui:FilterBehavior x:Name="filterBehavior" ActualFilterCriteriaChanged="filterBehavior_ActualFilterCriteriaChanged">
            <dxfui:FilterField FieldName="CategoryName">
                <dxe:ComboBoxEditSettings ItemsSource="{Binding Categories}"/>
            </dxfui:FilterField>
        </dxfui:FilterBehavior>
    </dxmvvm:Interaction.Behaviors>
    <dxfui:CheckedListFilterElement FieldName="CategoryName" />
    <dxfui:CheckBoxFilterElement FieldName="Discontinued" />
    <!-- -->
</dxa:AccordionControl>
<!-- -->
<dxe:ListBoxEdit Name="listBoxEdit" ItemsSource="{Binding Products}">
    <!-- -->
</dxe:ListBoxEdit> 
void filterBehavior_ActualFilterCriteriaChanged(object sender, EventArgs e) {
    var viewModel = (FilterBehaviorServerDataViewModel)DataContext;
    if(ReferenceEquals(filterBehavior.ActualFilterCriteria, null)) {
        viewModel.SetFilter(null);
    } else {
        var converter = new GridFilterCriteriaToExpressionConverter<ProductInfo>();
        var expression = converter.Convert(filterBehavior.ActualFilterCriteria);
        viewModel.SetFilter(expression);
    }
}
See Also