Filtering

  • 2 minutes to read

GridControl / TreeListControl

The GridControl and TreeListControl provide the following features to allow users to filter its data:

PivotGridControl

The PivotGridControl provides the following features to allow users to filter its data:

TIP

Demo: Excel Style Filtering

Requires a WPF Subscription. Download

Other Data-bound Controls

If a data-bound control does not provide a filtering UI (for example, Charts and Data Editors), you can use the FilterBehavior to allow the Filter Editor / Filter Elements to filter the control's data:

  1. Add the FilterBehavior to the behaviors of the Filter Editor / Filter Elements or a container that holds them. The FilterBehavior automatically specifies the FilterEditorControl.Context / FilterElement.Context properties.
  2. Specify the FilterBehavior.ItemsSource property to allow the Filter Editor / Filter Elements to get unique filter values.
  3. Specify the FilterBehavior.Fields property to configure display fields, edit settings, and predefined filters.
  4. The FilterBehavior creates the FilterBehavior.ActualFilterCriteria object. Do one of the following:

TIP

Topic: FilterBehavior

The following code sample shows how to use the FilterBehavior to allow the Filter Elements to work with the ListBoxEdit.

<dxe:ListBoxEdit Name="listBoxEdit" ItemsSource="{Binding Products}"
                 FilterCriteria="{Binding ElementName=filterBehavior, Path=ActualFilterCriteria}"/>

<!-- -->    

<dxfui:CheckedListFilterElement FieldName="CategoryName">
    <dxmvvm:Interaction.Behaviors>
        <dxfui:FilterBehavior x:Name="filterBehavior" 
                              ItemsSource="{Binding ElementName=listBoxEdit, Path=ItemsSource}">
            <dxfui:FilterField FieldName="CategoryName">
                <dxe:ComboBoxEditSettings ItemsSource="{Binding Categories}"/>
            </dxfui:FilterField>
        </dxfui:FilterBehavior>
    </dxmvvm:Interaction.Behaviors>
</dxfui:CheckedListFilterElement>
TIP

Demo: FilterBehavior

Requires a WPF Subscription. Download