How to: Display the Customization Form near the PivotGridControl

  • 2 minutes to read

This example demonstrates how to display the Customization Form near the PivotGridControl.

In this example, the SplitContainerControl is used as a parent container for the Pivot Grid Control and Customization Form. The PivotGridControl.ShowingCustomizationForm event is handled to change the default behavior of the Customization Form.

The CustomizationFormShowingEventArgs.ParentControl property is used to set SplitContainerControl.Panel2 as an owner of the Customization Form. The Customization Form is docked to the parent container using the CustomizationFormShowingEventArgs.CustomizationForm property.

The style of the Customization Form is set using the PivotGridOptionsCustomization.CustomizationFormStyle property. The PivotGridControl.FieldsCustomization method is used to invoke the Customization Form.

using System;
using System.Windows.Forms;

namespace StandaloneCustForm {
    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);

            // Sets the style of the Customization Form and invokes it.
            pivotGridControl1.OptionsCustomization.CustomizationFormStyle = 
                DevExpress.XtraPivotGrid.Customization.CustomizationFormStyle.Excel2007;
            pivotGridControl1.FieldsCustomization();
        }

        private void pivotGridControl1_ShowingCustomizationForm(object sender, 
            DevExpress.XtraPivotGrid.CustomizationFormShowingEventArgs e) {

            // Sets the control which will own the Customization Form.
            e.ParentControl = splitContainerControl1.Panel2;

            // Sets the dock style applied to the Customization Form.
            e.CustomizationForm.Dock = DockStyle.Fill;
        }
    }
}