PivotGridControl.RestoreLayoutFromStream(Stream, OptionsLayoutBase) Method
SECURITY NOTE
Deserializing layout settings from untrusted resources may create security issues. Review the following help topic for additional information: Safe Deserialization.
Restores a Pivot Grid Control’s layout from the specified stream, using the specified settings.
Namespace: DevExpress.XtraPivotGrid
Assembly: DevExpress.XtraPivotGrid.v24.2.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
stream | Stream | A Stream descendant which contains the layout settings. If null (Nothing in Visual Basic), an exception is raised. |
options | OptionsLayoutBase | A OptionsLayoutBase descendant which specifies which options should be restored. |
Remarks
Use the RestoreLayoutFromStream method to load the Pivot Grid Control’s layout from the stream to which the layout was saved via the PivotGridControl.SaveLayoutToStream method.
The options parameter determines which options should be restored from the stream. For a Pivot Grid Control a OptionsLayoutGrid object can be created, customized as required and then passed as the options parameter. Only the options that are enabled in this object will be restored.
To restore all the options you can pass null or the static OptionsLayoutBase.FullLayout property as the options parameter.
The RestoreLayoutFromStream method overload without the options parameter restores only the options which are specified by the Pivot Grid Control’s PivotGridControl.OptionsLayout property.
Note
When restoring a layout during a form load (for instance, in your Form.Load event handler), you may need to call the PivotGridControl.ForceInitialize method prior to the layout restoration. See this method to learn more.
Example
The following sample code saves a Pivot Grid Control’s layout to a memory stream and then restores it.
System.IO.Stream stream;
stream = new System.IO.MemoryStream();
pivotGridControl1.SaveLayoutToStream(stream);
stream.Seek(0, System.IO.SeekOrigin.Begin);
// ...
pivotGridControl1.RestoreLayoutFromStream(stream);
stream.Seek(0, System.IO.SeekOrigin.Begin);
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the RestoreLayoutFromStream(Stream, OptionsLayoutBase) 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.