Hi Actipro Support
We got a problem about serializing DockSite to string with DockSiteLayoutSerializer.
I am using the following code to create the ToolWindow:
ToolWindow toolWindow = new ToolWindow(_mainWindowDockSite,
windowKey,
windowTitle,
windowImageSource,
windowInfo.ContentHostUserControl)
{
HasTitleBar = hasTitleBar,
HasOptions = hasOptions,
CanDrag = canDrag,
CanRaft = canFloat,
CanAttach = canAttach,
CanAutoHide = canAutoHide,
CanBecomeDocument = canBecomeDocument,
CanDockTop = canDockHostTop,
CanDockBottom = canDockHostBottom,
CanDockLeft = canDockHostLeft,
CanDockRight = canDockHostRight,
CanClose = canClose,
};
toolWindow.Dock(_mainWindowDockSite, ToDirection(dockingDirection));
toolWindow.Open();
toolWindow.Activate(true);
And using the following code to get the serialized string:
string _inlineWindowsLayout = new DockSiteLayoutSerializer().SaveToString(dockSite);
_inlineWindowsLayout will be save to the user.config file, which will be used for restoring when the application restarts.
Every time when I do the folowing things, the saved serialized string was appended with some "track" xml element:
1. open the application
2. create tool window
3. close the tool window
4. close the application
followings are the save _inlineWindowsLayout with different time of created and closed tool window
Open app, create tool wnd, close tool wnd, close app once:
<DockSiteLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SerializationFormat="ToolWindowsOnly">
<AutoHideHost>
<AutoHideTabStrip Side="Bottom">
<ToolWindowContainer AutoHideSize="200,200" DockedSize="200,200" DocumentSize="200,200" FloatingSize="200,200" Size="200,200" SelectedWindowUniqueId="c1128aec-7f78-46a4-9668-277d1527d2d8">
<UIElement xsi:type="ToolWindowRef" UniqueId="c1128aec-7f78-46a4-9668-277d1527d2d8" />
</ToolWindowContainer>
</AutoHideTabStrip>
</AutoHideHost>
<Content xsi:type="SplitContainer" AutoHideSize="1910,856" DockedSize="1910,856" DocumentSize="1910,877" FloatingSize="1910,856" Size="1910,856" Orientation="Vertical">
<UIElement xsi:type="Workspace" AutoHideSize="1910,856" DockedSize="1910,856" DocumentSize="1910,856" FloatingSize="1910,856" Size="1910,856">
<Content xsi:type="TabbedMdiHost" />
</UIElement>
<UIElement xsi:type="ToolWindowContainer" AutoHideSize="1910,200" DockedSize="1910,200" DocumentSize="1910,200" FloatingSize="1910,200" Size="1910,200">
<UIElement xsi:type="Track" UniqueId="c1128aec-7f78-46a4-9668-277d1527d2d8" />
</UIElement>
</Content>
<ToolWindows>
<ToolWindow UniqueId="c1128aec-7f78-46a4-9668-277d1527d2d8" AutoHideSize="200,200" DockedSize="200,200" DocumentSize="200,200" FloatingSize="200,200" Size="200,200" IsOpen="true" LastState="Docked" Name="_00f7881e_825d_4b72_9c5a_4288ef3703c2" StandardMdiBounds="0,0,300,200" State="AutoHide" />
</ToolWindows>
</DockSiteLayout>
Open app, create tool wnd, close tool wnd, close app twice:
<DockSiteLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SerializationFormat="ToolWindowsOnly">
<AutoHideHost>
<AutoHideTabStrip Side="Bottom">
<ToolWindowContainer AutoHideSize="200,200" DockedSize="200,200" DocumentSize="200,200" FloatingSize="200,200" Size="200,200">
<UIElement xsi:type="Track" UniqueId="c1128aec-7f78-46a4-9668-277d1527d2d8" />
</ToolWindowContainer>
<ToolWindowContainer AutoHideSize="200,200" DockedSize="200,200" DocumentSize="200,200" FloatingSize="200,200" Size="200,200" SelectedWindowUniqueId="8e204c69-c86f-4a97-a7b5-898057060c13">
<UIElement xsi:type="ToolWindowRef" UniqueId="8e204c69-c86f-4a97-a7b5-898057060c13" />
</ToolWindowContainer>
</AutoHideTabStrip>
</AutoHideHost>
<Content xsi:type="SplitContainer" AutoHideSize="1910,856" DockedSize="1910,856" DocumentSize="1910,877" FloatingSize="1910,856" Size="1910,856" Orientation="Vertical">
<UIElement xsi:type="Workspace" AutoHideSize="1910,856" DockedSize="1910,856" DocumentSize="1910,856" FloatingSize="1910,856" Size="1910,856">
<Content xsi:type="TabbedMdiHost" />
</UIElement>
<UIElement xsi:type="ToolWindowContainer" AutoHideSize="1910,200" DockedSize="1910,200" DocumentSize="1910,200" FloatingSize="1910,200" Size="1910,200">
<UIElement xsi:type="Track" UniqueId="8e204c69-c86f-4a97-a7b5-898057060c13" />
</UIElement>
<UIElement xsi:type="ToolWindowContainer" AutoHideSize="1910,200" DockedSize="1910,200" DocumentSize="1910,200" FloatingSize="1910,200" Size="1910,200">
<UIElement xsi:type="Track" UniqueId="c1128aec-7f78-46a4-9668-277d1527d2d8" />
</UIElement>
</Content>
<ToolWindows>
<ToolWindow UniqueId="8e204c69-c86f-4a97-a7b5-898057060c13" AutoHideSize="200,200" DockedSize="200,200" DocumentSize="200,200" FloatingSize="200,200" Size="200,200" IsOpen="true" LastState="Docked" Name="_00f7881e_825d_4b72_9c5a_4288ef3703c2" StandardMdiBounds="0,0,300,200" State="AutoHide" />
</ToolWindows>
</DockSiteLayout>
Open app, create tool wnd, close tool wnd, close app three times:
<DockSiteLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SerializationFormat="ToolWindowsOnly">
<AutoHideHost>
<AutoHideTabStrip Side="Bottom">
<ToolWindowContainer AutoHideSize="200,200" DockedSize="200,200" DocumentSize="200,200" FloatingSize="200,200" Size="200,200">
<UIElement xsi:type="Track" UniqueId="c1128aec-7f78-46a4-9668-277d1527d2d8" />
</ToolWindowContainer>
<ToolWindowContainer AutoHideSize="200,200" DockedSize="200,200" DocumentSize="200,200" FloatingSize="200,200" Size="200,200">
<UIElement xsi:type="Track" UniqueId="8e204c69-c86f-4a97-a7b5-898057060c13" />
</ToolWindowContainer>
<ToolWindowContainer AutoHideSize="200,200" DockedSize="200,200" DocumentSize="200,200" FloatingSize="200,200" Size="200,200" SelectedWindowUniqueId="08ede896-434f-443a-8929-9f0aec8cbc36">
<UIElement xsi:type="ToolWindowRef" UniqueId="08ede896-434f-443a-8929-9f0aec8cbc36" />
</ToolWindowContainer>
</AutoHideTabStrip>
</AutoHideHost>
<Content xsi:type="SplitContainer" AutoHideSize="1910,856" DockedSize="1910,856" DocumentSize="1910,877" FloatingSize="1910,856" Size="1910,856" Orientation="Vertical">
<UIElement xsi:type="Workspace" AutoHideSize="1910,856" DockedSize="1910,856" DocumentSize="1910,856" FloatingSize="1910,856" Size="1910,856">
<Content xsi:type="TabbedMdiHost" />
</UIElement>
<UIElement xsi:type="ToolWindowContainer" AutoHideSize="1910,200" DockedSize="1910,200" DocumentSize="1910,200" FloatingSize="1910,200" Size="1910,200">
<UIElement xsi:type="Track" UniqueId="08ede896-434f-443a-8929-9f0aec8cbc36" />
</UIElement>
<UIElement xsi:type="ToolWindowContainer" AutoHideSize="1910,200" DockedSize="1910,200" DocumentSize="1910,200" FloatingSize="1910,200" Size="1910,200">
<UIElement xsi:type="Track" UniqueId="8e204c69-c86f-4a97-a7b5-898057060c13" />
</UIElement>
<UIElement xsi:type="ToolWindowContainer" AutoHideSize="1910,200" DockedSize="1910,200" DocumentSize="1910,200" FloatingSize="1910,200" Size="1910,200">
<UIElement xsi:type="Track" UniqueId="c1128aec-7f78-46a4-9668-277d1527d2d8" />
</UIElement>
</Content>
<ToolWindows>
<ToolWindow UniqueId="08ede896-434f-443a-8929-9f0aec8cbc36" AutoHideSize="200,200" DockedSize="200,200" DocumentSize="200,200" FloatingSize="200,200" Size="200,200" IsOpen="true" LastState="Docked" Name="_00f7881e_825d_4b72_9c5a_4288ef3703c2" StandardMdiBounds="0,0,300,200" State="AutoHide" />
</ToolWindows>
</DockSiteLayout>
.................
May I know why and the solution!