User Folders

  • 3 minutes to read

Pivot Grid Control allows you to group fields in the Customization Form by putting them into user-defined folders.

UserFolders

To create a folder, set at least one field to be displayed in this folder. Use the PivotGridFieldBase.DisplayFolder property to do this.

You can also create folder hierarchies by putting folders one into another. In this instance, use the "" symbol as a delimiter when specifying folder names.

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

Example

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();
        }
    }
}
See Also