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.v24.2.dll
NuGet Package: DevExpress.Wpf.Core
Declaration
See AddBeforeLoadLayoutHandler(DependencyObject, BeforeLoadLayoutEventHandler) and RemoveBeforeLoadLayoutHandler(DependencyObject, BeforeLoadLayoutEventHandler).
Remarks
Do the following to prevent a layout from being restored (deserialized):
- Handle the
BeforeLoadLayout
event. - 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