Back to Devexpress

DockManager.RestoreLayoutFromStream(Stream) Method

windowsforms-devexpress-dot-xtrabars-dot-docking-dot-dockmanager-dot-restorelayoutfromstream-x28-system-dot-io-dot-stream-x29.md

latest4.5 KB
Original Source

DockManager.RestoreLayoutFromStream(Stream) Method

SECURITY-RELATED CONSIDERATIONS

Deserializing layout settings from untrusted resources may create security issues. Review the following help topic for additional information: Safe Deserialization.

Restores the layout of dock panels from the specified stream.

Namespace : DevExpress.XtraBars.Docking

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public virtual void RestoreLayoutFromStream(
    Stream stream
)
vb
Public Overridable Sub RestoreLayoutFromStream(
    stream As Stream
)

Parameters

NameTypeDescription
streamStream

A Stream descendant from which the dock panels’ settings are read. If null ( Nothing in Visual Basic), an exception is raised.

|

Remarks

Note

When restoring a layout during a form load (for instance, in your Form.Load event handler), you may need to call the DockManager.ForceInitialize method prior to the layout restoration. See this method to learn more.

For more information, see Saving and Restoring the Layout of Dock Panels

Example

The following code demonstrates how to write and read the docking layout to and from memory.

csharp
System.IO.Stream stream = new System.IO.MemoryStream();
dockManager1.SaveLayoutToStream(stream);
// Set the stream pointer to the beginning.
stream.Seek(0, System.IO.SeekOrigin.Begin);

// ...

dockManager1.RestoreLayoutFromStream(stream);
// Set the stream pointer to the beginning.
stream.Seek(0, System.IO.SeekOrigin.Begin);
vb
Dim stream As System.IO.Stream
stream = New System.IO.MemoryStream()
DockManager1.SaveToStream(stream)
' Set the stream pointer to the beginning.
stream.Seek(0, System.IO.SeekOrigin.Begin)

' ...

DockManager1.RestoreFromStream(stream)
' Set the stream pointer to the beginning.
stream.Seek(0, System.IO.SeekOrigin.Begin)

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.

xaf-how-to-create-information-panels/VB/InfoPanels.Module.Win/MainForm.vb#L66

vb
Dim stream As MemoryStream = New MemoryStream(Encoding.UTF8.GetBytes(ModelTemplate.DockManagerSettings))
    DockManager.RestoreLayoutFromStream(stream)
End If

See Also

SaveLayoutToStream(Stream)

RestoreLayoutFromRegistry(String)

RestoreLayoutFromXml(String)

RestoreLayoutError

Save and Restore Layouts of DevExpress controls

DockManager Class

DockManager Members

DevExpress.XtraBars.Docking Namespace