Back to Devexpress

PivotGridControl.ShowingCustomizationForm Event

windowsforms-devexpress-dot-xtrapivotgrid-dot-pivotgridcontrol-7a202d36.md

latest6.9 KB
Original Source

PivotGridControl.ShowingCustomizationForm Event

Occurs before the Customization Form is displayed.

Namespace : DevExpress.XtraPivotGrid

Assembly : DevExpress.XtraPivotGrid.v25.2.dll

NuGet Package : DevExpress.Win.PivotGrid

Declaration

csharp
public event CustomizationFormShowingEventHandler ShowingCustomizationForm
vb
Public Event ShowingCustomizationForm As CustomizationFormShowingEventHandler

Event Data

The ShowingCustomizationForm event's data class is CustomizationFormShowingEventArgs. The following properties provide information specific to this event:

PropertyDescription
CancelGets or sets whether the standard Customization Form should be canceled.
CustomizationFormProvides access to the Customization Form.
HandledObsolete. Gets or sets whether the standard Customization Form should be canceled.
ParentControlGets or sets the control to which the Customization Form belongs.

Remarks

The ShowingCustomizationForm event occurs before the Customization Form is displayed. It allows the form to be customized or replaced with a custom form.

The CustomizationFormShowingEventArgs.CustomizationForm parameter refers to the standard Customization Form which is about to be displayed. If the event’s CustomizationFormShowingEventArgs.Cancel parameter is set to true the standard Customization Form will not be displayed. The CustomizationFormShowingEventArgs.ParentControl parameter specifies the control (PivotGrid control) which owns the form.

After the standard Customization Form has been invoked the PivotGridControl.ShowCustomizationForm event is raised.

Example

This example demonstrates how to display the Customization Form near the Pivot Grid.

The form is in SplitContainerControl - a parent container for the Pivot Grid and Customization Form. To specify the SplitContainer’s panel as the Customization Form’s owner, handle the PivotGridControl.ShowingCustomizationForm event and use the e.ParentControl property.

Specify the form’s appearance with the PivotGridOptionsCustomization.CustomizationFormStyle property.

Call the FieldsCustomization method to show the form.

cs
using System;
using System.Windows.Forms;

namespace StandaloneCustomForm {
    public partial class Form1 : DevExpress.XtraEditors.XtraForm {
        public Form1() {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e) {
            excelDataSource1.FileName = "SalesPerson.xlsx";
            excelDataSource1.Fill();

            // Set the Customization Form style and show the form.
            pivotGridControl1.OptionsCustomization.CustomizationFormStyle = 
                DevExpress.XtraPivotGrid.Customization.CustomizationFormStyle.Excel2007;
            pivotGridControl1.FieldsCustomization();
        }
        private void pivotGridControl1_ShowingCustomizationForm(object sender, 
            DevExpress.XtraPivotGrid.CustomizationFormShowingEventArgs e) {
            // Set the control that owns the Customization Form.
            e.ParentControl = splitContainerControl1.Panel2;

            e.CustomizationForm.Dock = DockStyle.Fill;
        }
    }
}
vb
Imports System
Imports System.Windows.Forms

Namespace StandaloneCustomForm
    Partial Public Class Form1
        Inherits DevExpress.XtraEditors.XtraForm

        Public Sub New()
            InitializeComponent()
        End Sub

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
            excelDataSource1.FileName = "SalesPerson.xlsx"
            excelDataSource1.Fill()

            ' Set the Customization Form style and show the form.
            pivotGridControl1.OptionsCustomization.CustomizationFormStyle = DevExpress.XtraPivotGrid.Customization.CustomizationFormStyle.Excel2007
            pivotGridControl1.FieldsCustomization()
        End Sub

        Private Sub pivotGridControl1_ShowingCustomizationForm(ByVal sender As Object, ByVal e As DevExpress.XtraPivotGrid.CustomizationFormShowingEventArgs) Handles pivotGridControl1.ShowingCustomizationForm
            ' Set the control that owns the Customization Form.
            e.ParentControl = splitContainerControl1.Panel2

            e.CustomizationForm.Dock = DockStyle.Fill
        End Sub
    End Class
End Namespace

See Also

CustomizationFormStyle

CustomizationForm

ShowCustomization

HideCustomizationForm

ShowCustomizationForm

Customization Form

PivotGridControl Class

PivotGridControl Members

DevExpress.XtraPivotGrid Namespace