User Folders
- 2 minutes to read
Pivot Grid Control allows you to group fields in the Customization Form by putting them into user-defined folders.
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.ShowCustomization 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 DevExpress.XtraEditors;
using System;
using System.Drawing;
using System.Windows.Forms;
namespace XtraPivotGrid_UserFolders {
public partial class Form1 : XtraForm {
public Form1() {
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e) {
this.salesPersonTableAdapter.Fill(this.nwindDataSet.SalesPerson);
excelDataSource1.FileName = "SalesPerson.xlsx";
excelDataSource1.Fill();
// Enable group folders in a customization window.
pivotGridControl1.OptionsView.GroupFieldsInCustomizationWindow = true;
// Specify the name of the folder that contains the Employees field.
fieldSalesPerson1.DisplayFolder = "Employees";
fieldSalesPerson1.Visible = false;
// Specify the root and the nested folder names.
fieldProductName1.DisplayFolder = "Products\\Name";
fieldCategoryName1.DisplayFolder = "Products\\Category";
fieldProductName1.Visible = false;
fieldCategoryName1.Visible = false;
// Invoke the Customization Form at the default location - the main window's bottom right corner.
pivotGridControl1.ShowCustomization();
}
}
}