/
Form1.cs
37 lines (28 loc) · 1.44 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Windows.Forms;
using DevExpress.XtraPivotGrid;
namespace GroupFilter {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e) {
// Binds the pivot grid to data.
this.salesPersonTableAdapter.Fill(this.nwindDataSet.SalesPerson);
// Gets the field group from the collection.
PivotGridGroup OrderDateGroup = pivotGridControl1.Groups[0];
// Locks the PivotGroupFilterValues object by disabling visual updates.
OrderDateGroup.FilterValues.BeginUpdate();
// Sets the filter type.
// It specifies that the PivotGridControl should display only filter values.
OrderDateGroup.FilterValues.FilterType = PivotFilterType.Included;
// Creates a filter value and adds it to the PivotGroupFilterValues.Values collection.
OrderDateGroup.FilterValues.Values.Add(new PivotGroupFilterValue(2014));
// Creates a filter value and adds it to the PivotGroupFilterValues.Values collection.
// Then creates a child value of the filter value and adds it to the parent value collection.
OrderDateGroup.FilterValues.Values.Add(2015).ChildValues.Add(1);
// Unlocks the PivotGroupFilterValues object.
OrderDateGroup.FilterValues.EndUpdate();
}
}
}