Skip to main content
All docs

DXSerializer.BeforeLoadLayout Attached Event

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

Namespace: DevExpress.Xpf.Core.Serialization

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



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