NavBarControl.SaveToXml(String) Method

Saves a control's layout to a specified XML file.

Namespace: DevExpress.XtraNavBar

Assembly: DevExpress.XtraNavBar.v20.1.dll

Declaration

public virtual void SaveToXml(
    string xmlFile
)
Public Overridable Sub SaveToXml(
    xmlFile As String
)

Parameters

Name Type Description
xmlFile String

A string value specifying the XML file name.

Remarks

Use the SaveToXML method to save the NavBarControl control's layout to an XML file. You can restore saved settings later via the NavBarControl.RestoreFromXml method call.

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 the way in which to save control layout to an XML file and then restore it. The NavBarControl.SaveToXml and NavBarControl.RestoreFromXml methods are used for this purpose.

The image below displays two NavBarControls 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 an XML file. The second control restores it. Note that only the layout of groups and links is saved.

SaveRestore

navBarControl1.SaveToXml("c:\\NavBarLayout.xml");
navBarControl2.RestoreFromXml("c:\\NavBarLayout.xml");
See Also