Skip to main content

PivotGridControl.RestoreLayoutFromRegistry(String, OptionsLayoutBase) Method

SECURITY NOTE

Deserializing layout settings from untrusted resources may create security issues. Review the following help topic for additional information: Safe Deserialization.

Restores the Pivot Grid Control’s layout stored at the specified system registry path, using the specified settings.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v24.1.dll

NuGet Package: DevExpress.Win.PivotGrid

Declaration

public void RestoreLayoutFromRegistry(
    string path,
    OptionsLayoutBase options
)

Parameters

Name Type Description
path String

A string value specifying the system registry path. If the specified path doesn’t exist, calling this method does nothing.

options OptionsLayoutBase

A OptionsLayoutBase descendant which specifies which options should be restored.

Remarks

Use the RestoreLayoutFromRegistry method to restore the layout of a Pivot Grid Control which has been stored to the system registry using the PivotGridControl.SaveLayoutToRegistry method.

The options parameter determines which options should be restored from the registry. For a Pivot Grid Control you can create a OptionsLayoutGrid object, customize it as required and then pass it as the options parameter. Only the options that are enabled in this object will be restored.

To restore all the options you can pass null or the static OptionsLayoutBase.FullLayout property as the options parameter.

The RestoreLayoutFromRegistry method overload without the options parameter restores only the options which are specified by the PivotGridControl.OptionsLayout property.

Each layout has a version attribute. When saving a layout its version is determined by the OptionsLayoutBase.LayoutVersion property. This property can be accessed via the PivotGridControl.OptionsLayout property.

Layout versions help when updating previously saved layouts. When a layout is being restored its version is compared with the version specified by the OptionsLayoutBase.LayoutVersion property. If the versions don’t match the PivotGridControl.LayoutUpgrade event is fired and this can be handled to customize the Pivot Grid Control immediately after the old layout has been loaded.

For the path parameter you can define whole and partial registry keys. For example, if you define “Software\Company", the full path will be as follows: “HKEY_CURRENT_USER\Software\Company". To store a layout in a different root key define the entire path in the following form “HKEY_LOCAL_MACHINE\Software\Company".

Note

When restoring a layout during a form load (for instance, in your Form.Load event handler), you may need to call the PivotGridControl.ForceInitialize method prior to the layout restoration. See this method to learn more.

See Also