DXSerializer.CustomGetSerializableProperties Attached Event
Allows you to serialize standard/custom controls or custom properties.
Namespace: DevExpress.Xpf.Core.Serialization
Assembly: DevExpress.Xpf.Core.v24.2.dll
NuGet Package: DevExpress.Wpf.Core
Declaration
See AddCustomGetSerializablePropertiesHandler(DependencyObject, CustomGetSerializablePropertiesEventHandler) and RemoveCustomGetSerializablePropertiesHandler(DependencyObject, CustomGetSerializablePropertiesEventHandler).
Remarks
Serialize Standard and Custom Controls
Do the following to save/restore properties of custom and standard controls:
- Specify the SerializationID property for a control that contains the layout you want to save/restore.
- Assign the
XtraSerializableProperty
attribute to the control’s properties whose values you want to save/restore. - Choose one of the following:
- Pass properties to the DXSerializer.AddCustomGetSerializablePropertiesHandler method.
- Handle the
CustomGetSerializableProperties
event and pass properties to the CustomGetSerializablePropertiesEventArgs.SetPropertySerializable method.
Save Properties that are not Marked with the XtraSerializablePropertyAttribute
- Handle the
CustomGetSerializableProperties
event. - 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