NavBarControl.RestoreFromRegistry(String) Method

Restores the control layout stored at a specified system registry path.

Namespace: DevExpress.XtraNavBar

Assembly: DevExpress.XtraNavBar.v20.1.dll

Declaration

public virtual void RestoreFromRegistry(
    string path
)
Public Overridable Sub RestoreFromRegistry(
    path As String
)

Parameters

Name Type Description
path String

A string value specifying the system registry path.

Remarks

Use the RestoreFromRegistry method to restore the NavBarControl's layout written to the system registry by the NavBarControl.SaveToRegistry method.

The control's layout is restored from the path specified by the path parameter. You are allowed to define whole and partial registry keys. For instance, if you define a partial key, "Software\MyCompany\MyTool" the full path will be as follows: "HKEY_CURRENT_USER\Software\MyCompany\MyTool". If you wish to store a layout in another root key, you should define the entire path, for instance: "HKEY_LOCAL_MACHINE\Software\MyCompany\MyTool".

NOTE

To allow a layout to be correctly saved and restored, ensure that all nav bar groups and items created at runtime have their names (the Name property) specified.

Examples

The following sample code demonstrates a way in which to save control layout to the registry and then restore it. The NavBarControl.SaveToRegistry and NavBarControl.RestoreFromRegistry methods are used for this purpose.

The image below displays two NavBarControl controls before and after code execution. Note that the second control is initially empty (it doesn't contain any groups and items). Layout information of the first control is saved to the registry. The second control restores it. Note that only the layout of groups and links is saved.

SaveRestore

navBarControl1.SaveToRegistry(
  "HKEY_LOCAL_MACHINE\\SOFTWARE\\DevExpress Inc\\NavBarLayout");
navBarControl2.RestoreFromRegistry(
  "HKEY_LOCAL_MACHINE\\SOFTWARE\\DevExpress Inc\\NavBarLayout");
See Also