Saves the bars’ layout to a stream.
NuGet Package: DevExpress.Win.Navigation
public virtual void SaveLayoutToStream( Stream stream )
Public Overridable Sub SaveLayoutToStream( stream As Stream )
A Stream descendant to which the bars’ layout is written.
After the bars’ layout has been saved using the SaveLayoutToStream method it can then be restored using the BarManager.RestoreLayoutFromStream 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.
You can utilize the Persistence Behavior or Workspace Manager component to save and restore layouts for all supported DevExpress controls at once.
The following code demonstrates how to write and read a BarManager’s state to/from memory using the System.IO.MemoryStream class.
System.IO.Stream stream = new System.IO.MemoryStream(); barManager1.SaveLayoutToStream(stream); //set the stream position to the beginning stream.Seek(0, System.IO.SeekOrigin.Begin); //... barManager1.RestoreLayoutFromStream(stream); //set the stream position to the beginning stream.Seek(0, System.IO.SeekOrigin.Begin);