public MainWindow() { InitializeComponent(); SalesPersonTableAdapter salesPersonDataAdapter = new SalesPersonTableAdapter(); // Binds the pivot grid to data. pivotGridControl1.DataSource = salesPersonDataAdapter.GetData(); // Creates a group and adds two fields to it. PivotGridGroup OrderDateGroup = pivotGridControl1.Groups.Add(pivotGridControl1.Fields[2], pivotGridControl1.Fields[3]); // Locks the PivotGroupFilterValues object by disabling visual updates. OrderDateGroup.FilterValues.BeginUpdate(); // Sets a filter type. // It specifies that the PivotGridControl should display only filter values. OrderDateGroup.FilterValues.FilterType = FieldFilterType.Included; // Creates a filter value and adds it to the PivotGroupFilterValues.Values collection. OrderDateGroup.FilterValues.Values.Add(1994); // 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(1995).ChildValues.Add(1); // Unlocks the PivotGroupFilterValues object. OrderDateGroup.FilterValues.EndUpdate(); }
public MainWindow() { InitializeComponent(); SalesPersonTableAdapter salesPersonDataAdapter = new SalesPersonTableAdapter(); pivotGridControl1.DataSource = salesPersonDataAdapter.GetData(); }
public MainWindow() { InitializeComponent(); // Binds the pivot grid to data. pivotGridControl1.DataSource = salesPersonDataAdapter.GetData(); // Creates a PivotGridCustomTotal object that defines the Median Custom Total. PivotGridCustomTotal medianCustomTotal = new PivotGridCustomTotal(); medianCustomTotal.SummaryType = FieldSummaryType.Custom; // Specifies a unique PivotGridCustomTotal.Tag property value // that will be used to distinguish between two Custom Totals. medianCustomTotal.Tag = "Median"; // Specifies formatting settings that will be used to display // Custom Total column/row headers. medianCustomTotal.Format = "{0} Median"; // Adds the Median Custom Total for the Sales Person field. fieldSalesPerson.CustomTotals.Add(medianCustomTotal); // Creates a PivotGridCustomTotal object that defines the Quartiles Custom Total. PivotGridCustomTotal quartileCustomTotal = new PivotGridCustomTotal(); quartileCustomTotal.SummaryType = FieldSummaryType.Custom; // Specifies a unique PivotGridCustomTotal.Tag property value // that will be used to distinguish between two Custom Totals. quartileCustomTotal.Tag = "Quartiles"; // Specifies formatting settings that will be used to display // Custom Total column/row headers. quartileCustomTotal.Format = "{0} Quartiles"; // Adds the Quartiles Custom Total for the Sales Person field. fieldSalesPerson.CustomTotals.Add(quartileCustomTotal); // Enables the Custom Totals to be displayed instead of Automatic Totals. fieldSalesPerson.TotalsVisibility = FieldTotalsVisibility.CustomTotals; pivotGridControl1.RowTotalsLocation = FieldRowTotalsLocation.Far; }