[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Collapse]Ribbon, Bars and Menu
     MDI Merging
    [Expand]Bar Manager Designer
    [Collapse]Runtime Customization and Layout Management
      Runtime Customization
      How To: Organize Bar Items into Categories
      Saving and Restoring a Bars Layout Automatically
      Saving and Restoring a Bars Layout Manually
      Layout Options and Customization Events
      Specifics of Bars Layout Calculation
    [Expand]Appearance and Hotkeys
   [Expand]Popup Menus
    Radial Menu
   [Expand]Common Features
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Saving and Restoring a Bars Layout Automatically

The bars' layout contains settings for all bars and bar item links that determine their behavior, position, size, etc. Once saved, a layout can be applied to any BarManager. This allows you to customize a bar only once, and then apply the saved settings to other bars in different applications. This topic provides information on how to automatically save the layout of bars.

Please refer to the Saving and Restoring a Bars Layout Manually topic for information on how to save the layout manually. For information on saving/restoring the layout of dock panels, see Saving and Restoring the Layout of Dock Panels.

For information on saving the layout of bar commands within the Ribbon Quick Access Toolbar, see this link.


When saving/loading the layout of bars and using the merging feature, take note of the following. If you saved the layout while bars have been merged, do not load this layout after the bars have been unmerged. Typically, you need to save and load the layout of bars while the bars are unmerged.

Expanded Saving and Restoring a Bars Layout Automatically

The Bar Manager can automatically save the bars' layout to the system registry when the form that owns the bars is being closed, and restore it when the form loads. By default, this functionality is disabled. To activate it, you must specify the registry path where the information should be stored using the BarManager's BarManager.RegistryPath property. Then, set the BarManager's BarManager.AutoSaveInRegistry property to true so that the bars' layout can be automatically saved/restored.

The following image shows how these properties can be specified at design time.

The following sample code below demonstrates how this can be performed programmatically.


The bar items within the Bar Manager and within the stored layout are identified by the values of their BarItem.Id properties. For items created at design time, the BarItem.Id properties are initialized automatically. For items created via code, you need to initialize their BarItem.Id properties manually, to allow the layout of the bars to be correctly saved and restored. To set the BarItem.Id property's value, the BarManager.GetNewItemId method can be used.



The automatic saving/loading of the bars' layout is only possible if the Bar Manager belongs to a System.Windows.Forms.Form class instance. Otherwise, you need to manually save/restore settings as described in the Saving and Restoring a Bars Layout Manually topic.

Expanded See Also

Is this topic helpful?​​​​​​​