This example saves and restores custom panels and its properties.
This example contains a custom panel derived from the LayoutPanel:
class MyCustomPanel : LayoutPanel {
...
}
To mark some panel properties as serializable, you can apply the XtraSerializablePropertyAttribute
to the setters of corresponding properties. Target properties can be a dependency or an attached type:
[DevExpress.Utils.Serializing.XtraSerializableProperty]
public int Prop1 { get; set; }
...
[DevExpress.Utils.Serializing.XtraSerializableProperty]
public static int GetProp2(DependencyObject obj) {
return (int)obj.GetValue(Prop2Property);
}
The CustomSerializationController class extends the DockLayoutManager serialization logic when you need to create new panels when you restore a layout.
To inject the CustomSerializationController class in the DockLayoutManager, you can override the CreateSerializationController()
method.
- CustomSerialization.cs (VB: CustomSerialization.vb)
- MainWindow.xaml (VB: MainWindow.xaml)
- MainWindow.xaml.cs (VB: MainWindow.xaml.vb)
- WPF Dock Layout Manager - Save and Restore Settings of All Controls That Are Present in the UI
- WPF Dock Layout Manager - Save and Restore the DockLayoutManager's Layout
(you will be redirected to DevExpress.com to submit your response)