[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Collapse]Pivot Grid
   [Expand]Getting Started
   [Expand]Binding to Data
   [Expand]Data Shaping
   [Expand]Data Analysis
     Field Groups
     Data Cell Layout
     Field Location and Order
    [Expand]Customization Form
     Best Fit
     Standalone Field Header Areas
     Group Value
     Save and Restore Layout
   [Expand]Printing and Exporting
   [Expand]End-User Interaction
   [Expand]MVVM Enhancements
   [Expand]UI Elements
   [Expand]End-User Capabilities
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Save and Restore Layout

A pivot grid's layout contains settings which determine how its visual elements behave - their size, position within the control, etc. A layout can be saved and then applied to any other Pivot Grid control. This allows you to customize a pivot grid just once, and then apply the saved settings to other pivot grids in other WPF applications.

Expanded Base Concepts

Expanded DXPivotGrid Specifics

The DXPivotGrid provides multiple options, allowing you to specify which settings should be saved/restored. These options are described below:

Option Description
PivotSerializationOptions.AddNewFields Specifies whether the fields that currently exist in the pivot grid, but do not exist in a layout when it's restored, should be retained.
PivotSerializationOptions.AddNewGroups Specifies whether the Field Groups that currently exist in the pivot grid, but do not exist in a layout when it's restored, should be retained.
PivotSerializationOptions.RemoveOldFields Specifies whether fields that exist in a layout when it is restored, but don't currently exist in the pivot grid, should be discarded.
PivotSerializationOptions.StoreLayoutMode Gets or sets which settings should be saved when saving the PivotGrid's layout. This is an attached property.

To save the layout, use the PivotGridControl.SaveLayoutToXml or PivotGridControl.SaveLayoutToStream method. To restore the previously saved layout, use the PivotGridControl.RestoreLayoutFromXml or PivotGridControl.RestoreLayoutFromStream method.


You should specify unique names for all pivot grid fields using the PivotGridField.Name property to correctly save and restore the layout.

Expanded Example: How to Save and Load the DXPivotGrid's Layout

The following example shows how to save the pivot grid's layout to a file in XML format. To investigate how this works, click the "Save" button, which calls the PivotGridControl.SaveLayoutToXml method. Once saved, the pivot grid's layout can then be restored by clicking the "Load" button, which calls the PivotGridControl.RestoreLayoutFromXml method.

Is this topic helpful?​​​​​​​