PivotGridControl.RestoreCollapsedStateFromStreamAsync(Stream, AsyncCompletedHandler) Method

Restores the collapsed state of field values from the specified stream asynchronously. Allows you to specify custom actions to be performed after this operation is completed.

Namespace: DevExpress.Xpf.PivotGrid

Assembly: DevExpress.Xpf.PivotGrid.v20.1.dll


public void RestoreCollapsedStateFromStreamAsync(
    Stream stream,
    AsyncCompletedHandler asyncCompleted
Public Sub RestoreCollapsedStateFromStreamAsync(
    stream As Stream,
    asyncCompleted As AsyncCompletedHandler


Name Type Description
stream Stream

A Stream descendant from which the collapsed state of field values is read. If null (Nothing in Visual Basic), an exception is raised.

asyncCompleted AsyncCompletedHandler

An AsyncCompletedHandler delegate referencing a method that should be executed after the operation is completed.


The RestoreCollapsedStateFromStreamAsync method is asynchronous. It starts executing the related operation in a background thread, and immediately returns control. The primary UI thread is not blocked, allowing the application to continue responding to end-user actions. For more information about the asynchronous mode, see Asynchronous Mode.

Use the RestoreCollapsedStateFromStreamAsync method to load the collapsed state of field values written to a stream via the PivotGridControl.SaveCollapsedStateToStream method.

The collapsed states of field values can only be restored in the same layout they were saved in. If the control layout was changed after saving the collapsed states (for instance, some fields have been reordered or hidden), the RestoreCollapsedStateFromStreamAsync method may have no effect, or may restore the collapsed states incorrectly. To ensure that the collapsed states are loaded correctly, prevent end-users from changing the control layout (the PivotGridControl.AllowDrag and PivotGridControl.AllowHideFields properties), or save and load the field values' collapsed states together with the control layout (the PivotGridControl.SaveLayoutToStream and PivotGridControl.RestoreLayoutFromStream methods).


The RestoreCollapsedStateFromStreamAsync method has no effect if used when data is not loaded (i.e. the PivotGridControl.DataSource property is not initialized).

See Also