Skip to main content

PivotGridControl.SaveLayoutToXml(String) Method

Saves the PivotGridControl’s layout to a file in XML format.

Namespace: DevExpress.Xpf.PivotGrid

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

NuGet Package: DevExpress.Wpf.PivotGrid


public void SaveLayoutToXml(
    string fileName


Name Type Description
fileName String

A String value that specifies the target file name.


To restore the grid layout previously saved by the SaveLayoutToXml method, use the RestoreLayoutFromXml or RestoreLayoutFromXmlAsync method.

Note that you should specify unique names for all pivot grid fields to correctly save and restore the layout. You can do this using the PivotGridField.Name property.

To learn more, see Save and Restore 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.

View Example: How to save and restore the layout to/from XML

Imports Microsoft.VisualBasic
Imports System.Data
Imports System.Data.OleDb
Imports System.Windows
Imports DevExpress.Xpf.PivotGrid
Imports HowToBindToMDB.NwindDataSetTableAdapters

Namespace HowToBindToMDB
    Partial Public Class MainWindow
        Inherits Window
        Private salesPersonDataTable As New NwindDataSet.SalesPersonDataTable()
        Private salesPersonDataAdapter As New SalesPersonTableAdapter()

        Public Sub New()
            pivotGridControl1.DataSource = salesPersonDataTable
        End Sub

        Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
        End Sub

        Private Sub buttonSave_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
        End Sub

        Private Sub buttonLoad_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
        End Sub
    End Class
End Namespace
See Also