Skip to main content
All docs
V26.1
  • Filtering

    • 2 minutes to read

    GridControl / TreeListControl

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

    Run Demo: Filtering in the GridControl Run Demo: Filtering in the TreeListControl

    PivotGridControl

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

    Run Demo: Excel Style Filtering

    Other Data-bound Controls

    If a data-bound control does not have integrated filter elements (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>
    

    Run Demo: FilterBehavior