Home › Architecture › Docklayoutdefinition
Overview Namespace: TheTechIdea.Beep.Winform.Controls.Docking.Models
DockLayoutDefinition is the root serializable object for persisting docking layouts. It contains three collections that capture the complete state:
Serialization Classes DockLayoutDefinition (root) Property Type Description SchemaVersion int Layout format version. Default 1 Groups List<DockGroupDefinition> Top-level docked groups (content-serialized) Floating List<FloatingPanelInfo> Floating panel positions AutoHidden List<AutoHiddenPanelInfo> Auto-hidden panel edges IsEmpty bool True when all collections are null/empty
DockGroupDefinition Property Type Description Position DockPosition Docked edge. Default Left SplitOrientation SplitOrientation Horizontal or Vertical. Default Horizontal SplitRatio float Proportional split. Default 0.5 PanelKeys List<string> Panel keys in this group (content-serialized) ActivePanelKey string Key of active panel. Default null Children List<DockGroupDefinition> Nested split children (content-serialized)
FloatingPanelInfo Property Type Description Key string Panel identifier Bounds Rectangle Screen position and size LastDockPosition DockPosition Position before floating. Default Left
AutoHiddenPanelInfo Property Type Description Key string Panel identifier Edge DockPosition Auto-hide edge. Default Left
Examples // Save to file
var def = manager.LayoutTree.ToDefinition();
string json = JsonConvert.SerializeObject(def, Formatting.Indented);
File.WriteAllText("layout.json", json);
// Restore from file
string json = File.ReadAllText("layout.json");
var def = JsonConvert.DeserializeObject<DockLayoutDefinition>(json);
manager.MaterializeFromDefinition(def);
// Check if layout is empty
if (def.IsEmpty)
Console.WriteLine("No layout to restore");