Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

NavBarControl.RestoreFromStream(Stream) Method

Loads a control’s layout from a stream.

Namespace: DevExpress.XtraNavBar

Assembly: DevExpress.XtraNavBar.v24.2.dll

NuGet Package: DevExpress.Win

#Declaration

public virtual void RestoreFromStream(
    Stream stream
)

#Parameters

Name Type Description
stream Stream

A System.IO.Stream object from which the control’s settings are read.

#Remarks

Use the RestoreFromStream method to load the control’s layout from a stream to which a layout was saved via the NavBarControl.SaveToStream 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.

#Example

The following sample code demonstrates the way in which to save the control layout to a stream and then restore it. The NavBarControl.SaveToStream and NavBarControl.RestoreFromStream methods are used for this purpose.

The image below displays two NavBarControl controls before and after code execution. Note that the second control is initially empty (it doesn’t contain any groups and items). Layout information for the first control is saved to a stream. The second control restores it. Note that only the layout of groups and links is saved.

SaveRestore

Imports System.IO

FileStream outFile = new FileStream("C:\\NavBarLayout", FileMode.Create);
navBarControl1.SaveToStream(outFile);
outFile.Close();
FileStream inFile = new FileStream("C:\\NavBarLayout", FileMode.Open);
navBarControl2.RestoreFromStream(inFile);
inFile.Close();
See Also