Saving and Restoring a Bar Layout

  • 2 minutes to read

A bar layout can be saved to a data store (an XML file or a stream), and then restored from this data store, overriding the changes made since the layout was saved. This document provides information on this topic.

Saving and Restoring a Bar Layout

The BarManager provides methods to save and restore a bar layout and bar items that belong to the BarManager:

You can save the layout of multiple DevExpress visual controls residing in a single object (e.g., window) in a centralized way, using the functionality provided by the DevExpress.Xpf.Core.Serialization.DXSerializer class. See Saving and Restoring Layout Basics, to learn more.

To save the layout of a control when a window is about to close, handle the Window.Closing event. To restore the layout when the window is being loaded, handle the Window.Loaded event.

NOTE

To serialize the layout of Standalone Bar Controls, place them inside a BarManager.

Example

The following code saves and restores the layout of bars and bar items that belong to a BarManager:

xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
<!--...-->
<dxb:BarManager x:Name="barManager1">
<!--...-->
See Also