Back to Devexpress

User Folders

windowsforms-11788-controls-and-libraries-pivot-grid-layout-customization-form-user-folders.md

latest4.9 KB
Original Source

User Folders

  • Oct 31, 2022
  • 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.

View Example

cs
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();

        }
    }
}
vb
Imports DevExpress.XtraEditors
Imports System
Imports System.Drawing
Imports System.Windows.Forms

Namespace XtraPivotGrid_UserFolders
    Partial Public Class Form1
        Inherits XtraForm

        Public Sub New()
            InitializeComponent()
        End Sub

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
            Me.salesPersonTableAdapter.Fill(Me.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()

        End Sub
    End Class
End Namespace

See Also

Customization Form Overview

Customization Form Styles