TreeList.RestoreLayoutFromStream(Stream) Method
Loads the control’s layout from a stream.
Namespace: DevExpress.XtraTreeList
Assembly: DevExpress.XtraTreeList.v20.1.dll
NuGet Package: DevExpress.Win.TreeList
Declaration
Parameters
Name | Type | Description |
---|---|---|
stream | Stream | A System.IO.Stream object from which the control’s settings are read. |
Remarks
Use the RestoreLayoutFromStream method to load the control’s layout from a stream to which a layout was saved via the TreeList.SaveLayoutToStream method call.
The Tree List options that are restored are identified by the TreeList.OptionsLayout object.
Note
When restoring a layout during a form load (for instance, in your Form.Load event handler), you may need to call the TreeList.ForceInitialize method prior to the layout restoration. See this method to learn more.
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();
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the RestoreLayoutFromStream(Stream) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.