Skip to main content
A newer version of this page is available. .

PivotCustomFilterPopupItemsEventArgs.Items Property

Gets the collection of filter items.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v19.1.dll

Declaration

public IList<PivotGridFilterItem> Items { get; }

Property Value

Type Description
IList<PivotGridFilterItem>

A list of PivotGridFilterItem objects that represent the filter items.

Remarks

Initially, the Items collection contains items representing the unique values stored in the underlying data source in the current field. To hide individual items from the filter dropdown, remove the respective elements from the Items collection.

To obtain the field for which the event has been raised, use the PivotCustomFilterPopupItemsEventArgs.Field property.

Example

The following example shows how to add and remove items from the filter dropdown list.In this example, the 'Beverages' item is hidden from the filter dropdown list of the Category field, and a dummy item is created and added to the list. To do this, the CustomFilterPopupItems event is handled. In the event handler, the 'Beverages' item is removed from the event parameter's Items collection, and a new item ('Dummy Item') is added to the collection.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraPivotGrid;
using DevExpress.XtraPivotGrid.Data;

namespace EmptyWinApp {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e) {
            this.productReportsTableAdapter.Fill(this.productReports._ProductReports);
        }
        readonly object dummyItem = new object();
        private void pivotGridControl1_CustomFilterPopupItems(object sender,
                                            PivotCustomFilterPopupItemsEventArgs e) {
            if(object.ReferenceEquals(e.Field, fieldCategoryName)) {
                for(int i = e.Items.Count - 1; i >= 0; i--) {
                    if(object.Equals(e.Items[i].Value, "Beverages")) {
                        e.Items.RemoveAt(i);
                        break;
                    }
                }
                e.Items.Insert(0, new PivotGridFilterItem(dummyItem,
                                                          "Dummy Item",
                                                          e.Field.FilterValues.Contains(dummyItem)));
            }
        }
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the Items property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also