DXSerializer.AllowProperty Attached Event
Allows you to prevent a property from deserialization.
Namespace: DevExpress.Xpf.Core.Serialization
Assembly: DevExpress.Xpf.Core.v24.2.dll
NuGet Package: DevExpress.Wpf.Core
Declaration
See AddAllowPropertyHandler(DependencyObject, AllowPropertyEventHandler) and RemoveAllowPropertyHandler(DependencyObject, AllowPropertyEventHandler).
Remarks
Do the following to prevent a property from being deserialized:
- Handle the
AllowProperty
event. - 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;
}
}
See Also