BarManager.SaveLayoutToRegistry(String) Method

Saves the bars’ layout to the specified system registry path.

Namespace: DevExpress.XtraBars

Assembly: DevExpress.XtraBars.v21.2.dll


public virtual bool SaveLayoutToRegistry(
    string path


Name Type Description
path String

The registry path to save the bars’ layout to.


Type Description

true if the bars’ layout has been saved to the specified system registry path; otherwise, false.


After the bars’ layout has been saved to the system registry using the SaveLayoutToRegistry method it can then be restored using the BarManager.RestoreLayoutFromRegistry method.

The Bar Manager allows you to automatically store the layout of its bars to the registry when the form is closed and restore the layout when the form is loaded. The BarManager.RegistryPath property specifies where the bars’ settings are stored in this case. Automatic saving/loading of bar layout is enabled if the BarManager.AutoSaveInRegistry property is set to true.

Bar items within the Bar Manager and within the stored layout are identified by unique identifiers specified by the BarItem.Id property. To correctly save the layout, ensure that this property is set to a unique value for each bar item. For items created at design time, the BarItem.Id properties are initialized automatically. For items created in code, you need to manually initialize their BarItem.Id properties.

For more information, see Saving and Restoring a Bars Layout Manually.


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


The following code demonstrates how to write and read a BarManager’s state to/from the system registry. The full path for the bars layout will be: HKEY_CURRENT_USER\DevExpress\XtraBars\States\MainState.

    string regKey = "DevExpress\\XtraBars\\States\\MainState";


See Also