Skip to main content

BaseView.SaveLayoutToRegistry(String) Method

Saves a View’s layout to a system registry path.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v24.2.dll

Declaration

public void SaveLayoutToRegistry(
    string path
)

Parameters

Name Type Description
path String

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

Remarks

Use the SaveLayoutToRegistry method to save the View’s layout to the system registry. You can then restore these settings using the BaseView.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 saving settings 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, for instance. An example is the “HKEY_LOCAL_MACHINE\Software\MyCompany\MyProject" registry path.

The ColumnView.OptionsLayout property controls which settings should be saved to the registry.

Important

The Document Manager identifies its child documents by names of controls hosted within these documents. Thus, it is recommended that you set unique names for these controls. Failure to comply with this recommendation will result in an exception for certain scenarios (e.g., saving and restoring a View layout by using 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 example saves the layout of the GridControl.MainView to the system registry and then restores it. The full path for the layout in the registry will be: HKEY_CURRENT_USER\DevExpress\XtraGrid\Layouts\MainLayout

    string regKey = "DevExpress\\XtraGrid\\Layouts\\MainLayout";
    gridControl1.MainView.SaveLayoutToRegistry(regKey);

    //...

    gridControl1.MainView.RestoreLayoutFromRegistry(regKey);
See Also