-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml.cs
33 lines (30 loc) · 1.19 KB
/
MainWindow.xaml.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
using System;
using System.Collections;
using System.Windows;
namespace DXPivotGrid_CustomSummary {
public partial class MainWindow : Window {
DataSet1TableAdapters.SalesPersonTableAdapter adapter =
new DataSet1TableAdapters.SalesPersonTableAdapter();
public MainWindow() {
InitializeComponent();
pivotGridControl1.DataSource = adapter.GetData();
}
private void pivotGridControl1_CustomSummary(object sender, DevExpress.Xpf.PivotGrid.PivotCustomSummaryEventArgs e) {
string name = e.DataField.FieldName;
IList list = e.CreateDrillDownDataSource();
Hashtable ht = new Hashtable();
for (int i = 0; i < list.Count; i++)
{
DevExpress.XtraPivotGrid.PivotDrillDownDataRow row = list[i] as DevExpress.XtraPivotGrid.PivotDrillDownDataRow;
object v = row[name];
if (v != null && v != DBNull.Value)
ht[v] = null;
}
e.CustomValue = ht.Count;
}
private void PivotGridControl1_Loaded(object sender, RoutedEventArgs e)
{
pivotGridControl1.BestFit();
}
}
}