Skip to main content
All docs
V26.1
  • Filter Elements

    Filter Elements are separate controls within your application that can filter data in a bound PivotGridControl.

    Tip

    For an example, review our Demo Center application : Excel Style Filtering

    Requires the installation of a WPF Subscription. Download

    For element type information, review the Filter Element Types document section.

    Add a Standalone Filter Element

    1. Add a filter element (the FilterElement class descendant) to the markup.
    2. Set the attached FilterElement.Context property to associate the filter element with the PivotGridControl‘s filter context.
    3. Assign the field name to the FilterElement.FieldName property.

    The following code uses the CheckedListFilterElement to filter the PivotGridControl’s data by the fieldProductName values:

    <dxfui:CheckedListFilterElement 
        dxfui:FilterElement.Context="{Binding FilteringContext, ElementName=pivotGridControl1}" 
        FieldName="fieldProductName" />
    

    The image below shows the result:

    pivot-filter-elements-sample

    Create a Custom Filter Drop-Down

    1. Create a data template that contains the FilterElement class descendant.
    2. Set the element’s Name to PART_FilterElement.
    3. Assign the data template to the PivotGridField.CustomExcelStyleFilterPopupTemplate property.

    The following code snippet uses the CalendarFilterElement to filter the Order Date field values:

    <dxpg:PivotGridField
        Area="FilterArea"
        Caption="OrderDate"
        FieldName="OrderDate"
        GroupInterval="Date"
        Name="fieldOrderDate">
        <dxpg:PivotGridField.CustomExcelStyleFilterPopupTemplate>
            <DataTemplate>
                <dxfui:CalendarFilterElement Name="PART_FilterElement" />
            </DataTemplate>
        </dxpg:PivotGridField.CustomExcelStyleFilterPopupTemplate>
    </dxpg:PivotGridField>
    

    The image below shows the result:

    pivot-filter-elements-drop-down-sample

    Note

    The complete sample project How to Create a Custom Filter Drop-Down is available in the DevExpress Examples repository.