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
- Add a filter element (the FilterElement class descendant) to the markup.
- Set the attached FilterElement.Context property to associate the filter element with the PivotGridControl‘s filter context.
- 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:
Create a Custom Filter Drop-Down
- Create a data template that contains the FilterElement class descendant.
- Set the element’s Name to PART_FilterElement.
- 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:
Note
The complete sample project How to Create a Custom Filter Drop-Down is available in the DevExpress Examples repository.