Skip to main content
Bar

BarManager.SaveLayoutToXml(String) Method

Saves the bars’ layout to an XML file.

Namespace: DevExpress.XtraBars

Assembly: DevExpress.XtraBars.v23.2.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

public virtual void SaveLayoutToXml(
    string xmlFile
)

Parameters

Name Type Description
xmlFile String

A string value which specifies the path to the file where the bars’ layout should be stored. If an empty string is specified, an exception is raised.

Remarks

After the bars’ layout has been saved using the SaveLayoutToXml method it can then be restored using the BarManager.RestoreLayoutFromXml method.

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.

Tip

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

Example

The following code can be used to read and write a BarManager’s state from/to an XML file.

string xmlFile = "c:\\XtraBars\\States\\MainState.xml";
barManager1.SaveLayoutToXml(xmlFile);

//...

barManager1.RestoreLayoutFromXml(xmlFile);
See Also