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.BeforeLoadLayout Attached Event

In This Article

Occurs before the DXSerializer loads a layout from an XML file/Stream.

Namespace: DevExpress.Xpf.Core.Serialization

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

NuGet Package: DevExpress.Wpf.Core

#Declaration

#Remarks

Do the following to prevent a layout from being restored (deserialized):

  1. Handle the BeforeLoadLayout event.
  2. Set the BeforeLoadLayoutEventArgs.Allow event argument to false.
using DevExpress.Utils.Serializing;
using DevExpress.Xpf.Core.Serialization;
using DevExpress.Xpf.Grid;
using DevExpress.Xpf.Core;
// ...

public partial class MainWindow : Window {
    public MainWindow() {
        //...
        grid.AddHandler(DXSerializer.BeforeLoadLayoutEvent, new BeforeLoadLayoutEventHandler(BeforeLoadLayoutEvent));
    }

    void BeforeLoadLayoutEvent(object sender, BeforeLoadLayoutEventArgs e) {
        e.Allow = false;
    }
}
See Also