BaseView.RestoreLayoutFromRegistry(String, OptionsLayoutBase) Method

Restores the View's layout using the specified settings stored at the specified system registry path.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v20.1.dll


public void RestoreLayoutFromRegistry(
    string path,
    OptionsLayoutBase options
Public Sub RestoreLayoutFromRegistry(
    path As String,
    options As OptionsLayoutBase


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 specifying which options should be restored.


Use the RestoreLayoutFromRegistry method to restore the layout of a View which has been stored to the system registry using the BaseView.SaveLayoutToRegistry method.

The options parameter determines which options should be restored from the registry. For the 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.

Specific options which are disabled in the options parameter are not affected.

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

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

Each layout has a version attribute. When saving a layout its version is determined by the OptionsLayoutBase.LayoutVersion property of the View's ColumnView.OptionsLayout object.

Layout versions help when updating previously saved layouts. When a layout is being restored its version is compared with the version specified by the View's OptionsLayoutBase.LayoutVersion property. If the versions don't match the BaseView.LayoutUpgrade event is fired and this can be handled to customize the current View 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".


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

See Also