wpf-devexpress-dot-xpf-dot-core-dot-serialization-dot-dxserializer-05e443b3.md
Allows you to serialize standard/custom controls or custom properties.
Namespace : DevExpress.Xpf.Core.Serialization
Assembly : DevExpress.Xpf.Core.v25.2.dll
NuGet Package : DevExpress.Wpf.Core
See AddCustomGetSerializablePropertiesHandler(DependencyObject, CustomGetSerializablePropertiesEventHandler) and RemoveCustomGetSerializablePropertiesHandler(DependencyObject, CustomGetSerializablePropertiesEventHandler).
Do the following to save/restore properties of custom and standard controls:
XtraSerializableProperty attribute to the control’s properties whose values you want to save/restore.CustomGetSerializableProperties event and pass properties to the CustomGetSerializablePropertiesEventArgs.SetPropertySerializable method.CustomGetSerializableProperties event.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() { });
}
}
Imports DevExpress.Utils.Serializing
Imports DevExpress.Xpf.Core.Serialization
Imports DevExpress.Xpf.Grid
Imports DevExpress.Xpf.Core
'...
Public Partial Class MainWindow
Inherits Window
Public Sub New()
InitializeComponent()
Me.DataContext = Me
grid.Columns("Name").[AddHandler](DXSerializer.CustomGetSerializablePropertiesEvent, New CustomGetSerializablePropertiesEventHandler(CustomGetSerializablePropertiesHandler))
End Sub
Sub CustomGetSerializablePropertiesHandler(ByVal sender As Object, ByVal e As CustomGetSerializablePropertiesEventArgs)
e.SetPropertySerializable
TODO
End Sub
End Class
See Also