Nickolay Kabash
Nickolay Kabash

Reputation: 67

Devexpress TabbedView Free Layout Mode saving layout

I want to save layout from my TabbedView with a custom xml serializer/deserializer. From the manual https://documentation.devexpress.com/#WindowsForms/CustomDocument11355 its clear: There is no need to add, remove or modify docking containers manually. If you wish to arrange your documents and groups in code, use the DocumentGroup.DockTo method. But how to use this method? Possible position of document may differ from document ordering.

enter image description here

So i decided to use Docking containers. After that i have restored layout, but there is a problem: no splitters between DocumentGroups where added.

Here is a code:

TabbedView view = ((TabbedView)documentManager.View);

DockingContainer node = LoadViewsDockingContainers(parentNode.SelectSingleNode("DockingContainer"), documentManager);
view.RootContainer.Nodes.Add(node);
view.RootContainer.Nodes.RemoveRange(view.RootContainer.Nodes.Take(view.RootContainer.Nodes.Count - 1).ToArray());

private DockingContainer LoadViewsDockingContainers(XmlNode dockingContainerNode, DocumentManager documentManager)
{
    // adding nodes recursive 
    dockingContainer.Nodes.Add(LoadViewsDockingContainers(parentNode, documentManager));
    ....
    // adding element - DocumentGroup
    dockingContainer.Element = LoadGroupDockingContainers(node, documentManager, toRemove);
    return dockingContainer;
}

Upvotes: 0

Views: 174

Answers (0)

Related Questions