PivotGridControl.CustomFilterPopupItems Event
Allows you to customize items displayed in the Classic filter popup.
Namespace: DevExpress.XtraPivotGrid
Assembly: DevExpress.XtraPivotGrid.v24.2.dll
Declaration
Event Data
The CustomFilterPopupItems event's data class is PivotCustomFilterPopupItemsEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Field | Gets the field for which the event has been raised. |
Items | Gets the collection of filter items. |
ShowBlanksItem | Gets the ‘Show Blanks’ filter item. |
The event data class exposes the following methods:
Method | Description |
---|---|
CheckAllItems(Boolean) | Checks or unchecks all filter items in the PivotCustomFilterPopupItemsEventArgs.Items collection. |
Remarks
The CustomFilterPopupItems event is raised when an end-user invokes the filter drop-down list. The event parameter’s PivotCustomFilterPopupItemsEventArgs.Items property returns a collection of filter items. Elements of the collection are represented by the PivotGridFilterItem objects. Initially, the filter items collection contains items representing the unique values stored in the underlying data source in the current field. To hide particular items from the filter drop-down, remove them from the collection.
You can also specify the check state of filter items using their PivotGridFilterItem.IsChecked property. The event parameter provides the PivotCustomFilterPopupItemsEventArgs.CheckAllItems method, which allows you to specify the check state of all filter items in the collection.
To obtain the field for which the filter drop-down is being populated, use the event parameter’s PivotCustomFilterPopupItemsEventArgs.Field property.
The filter drop-down list contains the ‘Show Blanks’ item used to control whether the data records that contain null values in the respective field are processed by the PivotGridControl. To access the ‘Show Blanks’ filter item, use the PivotCustomFilterPopupItemsEventArgs.ShowBlanksItem property.
Note
In the OLAP mode, the PivotCustomFilterPopupItemsEventArgs.ShowBlanksItem property returns null.
Example
The following example shows how to hide filter items whose corresponding field values are not displayed.In this example, the Row Header Area of the PivotGrid contains two fields: 'Category Name' and 'Product Name'. If an end-user hides a particular product category via the 'Category Name' field's filter drop-down, the corresponding products will be excluded from the filter drop-down of the 'Product Name' field. To hide filter items, the CustomFilterPopupItems event is handled.
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace EmptyWinApp {
static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}