Skip to main content
A newer version of this page is available. .
All docs
V21.2

DXSerializer.AllowProperty Attached Event

Allows you to prevent a property from deserialization.

Namespace: DevExpress.Xpf.Core.Serialization

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

NuGet Package: DevExpress.Wpf.Core

Declaration

Remarks

Do the following to prevent a property from being deserialized:

  1. Handle the AllowProperty event.
  2. Set AllowPropertyEventArgs.Allow property to false.

The following code sample disables the GridControl ID column’s ActualWidthProperty predefined property deserialization:

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.Columns["ID"].AddHandler(DXSerializer.AllowPropertyEvent, new AllowPropertyEventHandler(OnAllowProperty));
    }

    void OnAllowProperty(object sender, AllowPropertyEventArgs e) {
        if (e.DependencyProperty == GridColumn.ActualWidthProperty)
            e.Allow = false;
    }
}

View Example: Prevent Certain GridControl Properties from being Serialized

See Also