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

DXSerializer.CustomGetSerializableProperties Attached Event

Allows you to serialize standard/custom controls or custom properties.

Namespace: DevExpress.Xpf.Core.Serialization

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

NuGet Package: DevExpress.Wpf.Core

Declaration

Remarks

Serialize Standard and Custom Controls

Do the following to save/restore properties of custom and standard controls:

  1. Specify the SerializationID property for a control that contains the layout you want to save/restore.
  2. Assign the XtraSerializableProperty attribute to the control’s properties whose values you want to save/restore.
  3. Choose one of the following:

View Example: How to implement DXSerializer support for custom and standard controls

Save Properties that are not Marked with the XtraSerializablePropertyAttribute

  1. Handle the CustomGetSerializableProperties event.
  2. Pass the property whose value you want to save/restore to the CustomGetSerializablePropertiesEventArgs.SetPropertySerializable method.

The following code sample saves (serializes) the GridColumn.Tag property:

Imports DevExpress.Utils.Serializing
Imports DevExpress.Xpf.Core.Serialization
Imports DevExpress.Xpf.Grid
Imports DevExpress.Xpf.Core
//...
public partial class MainWindow : Window {
    public MainWindow() {
        //...
        grid.AddHandler(DXSerializer.CustomGetSerializablePropertiesEvent, new CustomGetSerializablePropertiesEventHandler(CustomGetSerializablePropertiesHandler));
    }

    void CustomGetSerializablePropertiesHandler(object sender, CustomGetSerializablePropertiesEventArgs e) {
        e.SetPropertySerializable(GridColumn.TagProperty, new DXSerializable() { });
    }
}  
See Also