Skip to main content
All docs
V24.1

DXSerializer.Deserialize(DependencyObject, Stream, String, DXOptionsLayout) Method

Restores (deserializes) layouts of the specified container (or a control) and all its child elements from the Stream.

Namespace: DevExpress.Xpf.Core.Serialization

Assembly: DevExpress.Xpf.Core.v24.1.dll

NuGet Package: DevExpress.Wpf.Core

Declaration

public static void Deserialize(
    DependencyObject root,
    Stream stream,
    string appName = "",
    DXOptionsLayout options = null
)

Parameters

Name Type Description
root DependencyObject

A container (or a control) whose layouts should be restored.

stream Stream

The target Stream.

Optional Parameters

Name Type Default Description
appName String String.Empty

The application name.

options DXOptionsLayout null

Settings that specify whether the container’s child object layouts should be deserialized.

Remarks

Call this method to restore (deserialize) layouts of a container (Window, View, UserControl) and its child controls from a Stream.

The following code restores the layout of the window and its child GridControls from the Stream:

<Window . . .
    xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
    x:Name="mainWindow">
    <Grid>
        <dxg:GridControl dx:DXSerializer.SerializationID="gridControl1">
            <!--...-->
        </dxg:GridControl>
        <dxg:GridControl dx:DXSerializer.SerializationID="gridControl2">
            <!--...-->
        </dxg:GridControl>
    </Grid>
</Window>
using DevExpress.Xpf.Core.Serialization;

Stream mainWindowLayout = new MemoryStream();

private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) {
    DXSerializer.Serialize(mainWindow, mainWindowLayout);
}
private void Window_Loaded(object sender, System.ComponentModel.CancelEventArgs e) {
    DXSerializer.Deserialize(mainWindow, mainWindowLayout);
}
See Also