Back to Devexpress

PivotGridControl.SaveLayoutToRegistry(String) Method

windowsforms-devexpress-dot-xtrapivotgrid-dot-pivotgridcontrol-dot-savelayouttoregistry-x28-system-dot-string-x29.md

latest4.6 KB
Original Source

PivotGridControl.SaveLayoutToRegistry(String) Method

SECURITY-RELATED CONSIDERATIONS

Using file paths sourced from untrusted input may expose unauthorized files or allow unintended file access. Always validate and normalize all external paths to prevent path manipulation.

Saves a Pivot Grid Control’s layout to a system registry path.

Namespace : DevExpress.XtraPivotGrid

Assembly : DevExpress.XtraPivotGrid.v25.2.dll

NuGet Package : DevExpress.Win.PivotGrid

Declaration

csharp
public void SaveLayoutToRegistry(
    string path
)
vb
Public Sub SaveLayoutToRegistry(
    path As String
)

Parameters

NameTypeDescription
pathString

A string value which specifies the system registry path to which the layout is saved.

|

Remarks

If a Pivot Grid Control’s layout has been saved to the system registry using the SaveLayoutToRegistry method it can then be restored using the PivotGridControl.RestoreLayoutFromRegistry method.

You can define whole and partial registry keys as the parameter. For instance, specifying “Software\MyCompany\MyProject" as a partial key will result in settings being saved to the “HKEY_CURRENT_USER\Software\MyCompany\MyProject" path. You can also specify the entire path if you need to store the layout at another root key. An example is the “HKEY_LOCAL_MACHINE\Software\MyCompany\MyProject" registry path.

The PivotGridControl.OptionsLayout property provides options that define which settings should be saved to the registry.

Note

The expansion states of field values are not saved by the SaveLayoutToRegistry method.

Tip

You can utilize the Persistence Behavior or Workspace Manager component to save and restore layouts for all supported DevExpress controls at once.

Example

The following sample code can be used to write and read a Pivot Grid Control’s layout to/from the system registry. The full path for the Pivot Grid Control’s layout will be: HKEY_CURRENT_USER\DevExpress\XtraPivotGrid\Layouts\MainLayout.

csharp
string regKey = "DevExpress\\XtraPivotGrid\\Layouts\\PivotGridLayout";
pivotGridControl1.SaveLayoutToRegistry(regKey);

// ...

pivotGridControl1.RestoreLayoutFromRegistry(regKey);
vb
Dim regKey As String = "DevExpress\\XtraPivotGrid\\Layouts\\PivotGridLayout"
PivotGridControl1.SaveLayoutToRegistry(regKey)

' ...

PivotGridControl1.RestoreLayoutFromRegistry(regKey)

See Also

RestoreLayoutFromRegistry

SaveLayoutToStream

SaveLayoutToXml

SaveCollapsedStateToFile(String)

SaveCollapsedStateToStream(Stream)

LoadCollapsedStateFromFile(String)

LoadCollapsedStateFromStream(Stream)

OptionsLayout

Save and Restore Layouts of DevExpress controls

PivotGridControl Class

PivotGridControl Members

DevExpress.XtraPivotGrid Namespace