Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DXSerializer.Deserialize(DependencyObject[], Object, String, DXOptionsLayout) Method

Restores (deserializes) layouts of the specified container (or control) collection and all their child elements from the XML file/Stream.

Namespace: DevExpress.Xpf.Core.Serialization

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

NuGet Package: DevExpress.Wpf.Core

#Declaration

public static void Deserialize(
    DependencyObject[] dObjects,
    object path,
    string appName = "",
    DXOptionsLayout options = null
)

#Parameters

Name Type Description
dObjects DependencyObject[]

A collection of containers (or controls) whose layouts should be restored.

path Object

The target XML File’s path/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) collection and its child controls from a Stream.

The following code restores layouts of GridControls from the XML file:

<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;

private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) {
    DXSerializer.Serialize(new DependencyObject[] { gridControl1, gridControl2 }, "Layout.xml");
}
private void Window_Loaded(object sender, System.ComponentModel.CancelEventArgs e) {
    DXSerializer.Deserialize(new DependencyObject[] { gridControl1, gridControl2 }, "Layout.xml");
}
See Also