Skip to main content
All docs
V25.1
  • DevExpress v25.1 Update — Your Feedback Matters

    Our What's New in v25.1 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.AllowProperty Attached Event

    In This Article

    Allows you to prevent a property from deserialization.

    Namespace: DevExpress.Xpf.Core.Serialization

    Assembly: DevExpress.Xpf.Core.v25.1.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 WidthProperty predefined property deserialization:

    using DevExpress.Xpf.Core.Serialization;
    using DevExpress.Xpf.Grid;
    // ...
    
    public partial class MainWindow : Window {
        public MainWindow() {
            //...
            grid.Columns[nameof(Customer.ID)].AddHandler(DXSerializer.AllowPropertyEvent, 
                  new AllowPropertyEventHandler(OnAllowProperty));
        }
    
        void OnAllowProperty(object sender, AllowPropertyEventArgs e) {
            if (e.DependencyProperty == GridColumn.WidthProperty)
                e.Allow = false;
        }
    }
    

    View Example: Exclude GridControl's Properties from Serialization

    See Also