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

How to: Create User Folders within the Customization Form

  • 2 minutes to read

The following example shows how to group fields in the Customization Form by putting them in user-defined folders.

In this example, the Customization Form is invoked by calling the PivotGridControl.FieldsCustomization method.

To enable displaying user folders, the PivotGridOptionsViewBase.GroupFieldsInCustomizationWindow property is set to true.

To create a folder for the Sales Person field, its PivotGridFieldBase.DisplayFolder property is set to “Employees”. To create the main folder and nested folders for Product Name and Category Name fields, their PivotGridFieldBase.DisplayFolder properties are set to “Products\Name” and “Products\Category” respectively.

using System;
using System.Drawing;
using System.Windows.Forms;

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

            // Enables displaying user folders.
            pivotGridControl1.OptionsView.GroupFieldsInCustomizationWindow = true;

            // Specifies the name of the folder in which the Employees field is located.
            fieldSalesPerson.DisplayFolder = "Employees";

            // Specifies names of the main folder and nested folders in which 
            // the Product Name and Category Name fields are located.
            // Uses the "\" symbol as a delimiter when specifying folder names.
            fieldProductName.DisplayFolder = "Products\\Name";
            fieldCategoryName.DisplayFolder = "Products\\Category";

            // Invokes the Customization Form at the lower right corner of the main window.
            pivotGridControl1.FieldsCustomization();
        }
    }
}