Skip to main content

TreeList.SaveLayoutToStream(Stream) Method

Saves the control’s layout to a stream.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v23.2.dll

NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.TreeList

Declaration

public virtual void SaveLayoutToStream(
    Stream stream
)

Parameters

Name Type Description
stream Stream

A System.IO.Stream object to which the control’s layout is written.

Remarks

Use the SaveLayoutToStream method to write the TreeList control’s layout to a stream. You can read stored settings from the stream via the TreeList.RestoreLayoutFromStream method.

The Tree List options that are saved are identified by the TreeList.OptionsLayout object.

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 sample code saves layout of the Tree List control to a file stream and then restores it. The TreeList.SaveLayoutToStream and TreeList.RestoreLayoutFromStream methods are used for this purpose.

string fileName = "C:\\TreeListLayout";
System.IO.FileStream outFile = new System.IO.FileStream(fileName, System.IO.FileMode.Create);
treeList1.SaveLayoutToStream(outFile);
outFile.Close();
treeList2.DataSource = treeList1.DataSource;
System.IO.FileStream inFile = new System.IO.FileStream(fileName, System.IO.FileMode.Open);
treeList2.RestoreLayoutFromStream(inFile);
inFile.Close();
See Also