PivotGridControl.LayoutUpgrade Event

Occurs when a layout is restored from a data store (stream, XML file or system registry) and its version is different than the control’s current layout version.

Namespace: DevExpress.Xpf.PivotGrid

Assembly: DevExpress.Xpf.PivotGrid.v21.2.dll


public event PivotLayoutUpgradeEventHandler LayoutUpgrade

Event Data

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

Property Description
Handled Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route. Inherited from RoutedEventArgs.
OriginalSource Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class. Inherited from RoutedEventArgs.
PreviousVersion Returns the textual representation of the previous layout version.
RoutedEvent Gets or sets the RoutedEvent associated with this RoutedEventArgs instance. Inherited from RoutedEventArgs.
Source Gets or sets a reference to the object that raised the event. Inherited from RoutedEventArgs.

The event data class exposes the following methods:

Method Description
InvokeEventHandler(Delegate, Object) When overridden in a derived class, provides a way to invoke event handlers in a type-specific way, which can increase efficiency over the base implementation. Inherited from RoutedEventArgs.
OnSetSource(Object) When overridden in a derived class, provides a notification callback entry point whenever the value of the Source property of an instance changes. Inherited from RoutedEventArgs.


The LayoutUpgrade event allows you to customize a saved layout after an older version of the layout is loaded from a data store (stream, XML file, system registry). This event is raised when a control’s LayoutVersion property is changed and allows you to determine which properties should be updated when you upgrade the layout’s version.

Use the DXSerializer.LayoutVersion property or DXSerializer.SetLayoutVersion method to assign different versions to different layouts.

The following code snippet demonstrates how to handle the LayoutUpgrade event that updates the Pivot Grid’s previous layout to v2.0 and replaces the “oldField” with another “newField”.

<dxpg:PivotGridControl x:Name="newVersionPivotGrid" Grid.Row="2"  
                        DataSource="{Binding PivotData}"
<dxpg:PivotGridControl x:Name="oldVersionPivotGrid" Grid.Row="2" Grid.Column="1" 
                        DataSource="{Binding PivotData}"
private void newVersionPivotGrid_LayoutUpgrade(object sender, PivotLayoutUpgradeEventArgs e)
    if(e.PreviousVersion == "1.0")
        //Remove the obsolete field.
        var oldField = newVersionPivotGrid.Fields["oldField"];
        //Add the new field.
        var newField = new PivotGridField() {
            FieldName = "newField",
            Caption="New Value Field",
            Name = "newValueField",
            Area = FieldArea.DataArea
See Also