save and restore layout of toolwindow

Docking/MDI for WPF Forum

Posted 9 years ago by Ngo Thanh Duan
Avatar

About Docking&MDI,
I use DockSiteLayoutSerializer() to save and restore layout of toolwindow as following

#######################################################################
public void SaveLayout()
{
if (this.isLoadingLayout)
return;

if (layoutSerializer == null)
layoutSerializer = new DockSiteLayoutSerializer();
dockSiteLayout = layoutSerializer.SaveToString(dockSite);
}
########################################################################

I find XML string of dockSiteLayout as following.

#######################################################################################
- <DockSiteLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<AutoHideHost />
- <Content xsi:type="SplitContainer" UniqueId="57659e4f-5c39-43cc-bdfc-e72d71712936" AutoHideSize="300,300" DockedSize="300,300" DocumentSize="300,300" FloatingSize="300,300" Size="300,300" Orientation="Horizontal">
- <UIElement xsi:type="SplitContainer" UniqueId="f6047f5a-6a5a-4682-9132-329ca016f370" AutoHideSize="300,300" DockedSize="300,300" DocumentSize="300,300" FloatingSize="300,300" Size="300,300" Orientation="Vertical">
- <UIElement xsi:type="Workspace" UniqueId="1cd8728e-a2b9-4847-87da-06dbc7633e09" AutoHideSize="300,300" DockedSize="300,300" DocumentSize="300,300" FloatingSize="300,300" Size="300,300">
- <Content xsi:type="TabbedMdiHost">
- <Content xsi:type="SplitContainer" UniqueId="0b495668-5177-4647-a0a3-18dd36e10226" AutoHideSize="300,300" DockedSize="300,300" DocumentSize="300,300" FloatingSize="300,300" Size="300,300" Orientation="Horizontal">
- <UIElement xsi:type="TabbedMdiContainer" UniqueId="55d54d10-2065-49ce-98ed-1bbae6744425" AutoHideSize="148,300" DockedSize="148,300" DocumentSize="148,300" FloatingSize="148,300" Size="148,300" SelectedWindowUniqueId="18e77b50-af61-4b29-8477-58fc56033ab6">
<UIElement xsi:type="ToolWindowRef" UniqueId="b37f4ca5-4d1b-41e7-9087-4bc84e3eaa9b" Name="documentOptionsToolWindow1" />
<UIElement xsi:type="ToolWindowRef" UniqueId="f73b79b5-a1f6-42b5-beb9-7b3af8e2ef9e" Name="documentOptionsToolWindow2" />
<UIElement xsi:type="ToolWindowRef" UniqueId="f2848d0d-9a11-4b8c-903f-6a1d49eb44f2" Name="documentOptionsToolWindow3" />
<UIElement xsi:type="ToolWindowRef" UniqueId="54fcee1d-b207-409f-bc81-102c268a95e1" Name="documentOptionsToolWindow4" />
</UIElement>
<UIElement xsi:type="TabbedMdiContainer" UniqueId="1fb3bfd7-6f25-468a-b3e7-d7c7c6ee16e3" AutoHideSize="148,300" DockedSize="148,300" DocumentSize="148,300" FloatingSize="148,300" Size="148,300" SelectedWindowUniqueId="c3855343-ade2-45b5-8c90-9bc66081a993" />
</Content>
</Content>
</UIElement>
</UIElement>
</Content>
<RaftingHosts />
- <ToolWindows>
<ToolWindow UniqueId="b37f4ca5-4d1b-41e7-9087-4bc84e3eaa9b" AutoHideSize="300,300" DockedSize="300,300" DocumentSize="300,300" FloatingSize="300,300" Size="300,300" IsOpen="true" Name="documentOptionsToolWindow1" Title="Tool window 1" LastState="Docked" State="Document" />
<ToolWindow UniqueId="f73b79b5-a1f6-42b5-beb9-7b3af8e2ef9e" AutoHideSize="300,300" DockedSize="300,300" DocumentSize="300,300" FloatingSize="300,300" Size="300,300" IsOpen="true" Name="documentOptionsToolWindow2" Title="Tool window 2" LastState="Docked" State="Document" />
<ToolWindow UniqueId="f2848d0d-9a11-4b8c-903f-6a1d49eb44f2" AutoHideSize="300,300" DockedSize="300,300" DocumentSize="300,300" FloatingSize="300,300" Size="300,300" IsOpen="true" Name="documentOptionsToolWindow3" Title="Tool window 3" LastState="Docked" State="Document" />
<ToolWindow UniqueId="54fcee1d-b207-409f-bc81-102c268a95e1" AutoHideSize="300,300" DockedSize="300,300" DocumentSize="300,300" FloatingSize="300,300" Size="300,300" IsOpen="true" Name="documentOptionsToolWindow4" Title="Tool window 4" LastState="Docked" State="Document" />
</ToolWindows>
</DockSiteLayout>
#######################################################################################

I don't know how to generate XML string of dockSiteLayout when saving layout of tool window? Why can you make it exactly?
Beside I also need to save layout of document window.
Please help me supply some information.

Thanks you for any help.




[Modified at 08/06/2010 06:24 AM]

Comments (5)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Sorry but it doesn't save document window layouts yet, only tool windows right now. We are going to be adding document window layout serialization options in the upcoming WPF Studio 2010.2 version.


Actipro Software Support

Posted 9 years ago by Ngo Thanh Duan
Avatar
I see. Would you please tell me some information for document window layout?

Thank you very much
Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
As I mentioned before, we don't yet save document window layout. We only currently save tool window layout. Our next major version will have document window layout saving.


Actipro Software Support

Posted 9 years ago by Ngo Thanh Duan
Avatar
Thank you for your confirmation. I need to know how can I generate tool window layout to XML string if I don't use DockSiteLayoutSerializer?

Beside, I need to how to build control(tool window layout) from that XML string?
#######################################################################################
- <DockSiteLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<AutoHideHost />
- <Content xsi:type="SplitContainer" UniqueId="57659e4f-5c39-43cc-bdfc-e72d71712936" AutoHideSize="300,300" DockedSize="300,300" DocumentSize="300,300" FloatingSize="300,300" Size="300,300" Orientation="Horizontal">
- <UIElement xsi:type="SplitContainer" UniqueId="f6047f5a-6a5a-4682-9132-329ca016f370" AutoHideSize="300,300" DockedSize="300,300" DocumentSize="300,300" FloatingSize="300,300" Size="300,300" Orientation="Vertical">
- <UIElement xsi:type="Workspace" UniqueId="1cd8728e-a2b9-4847-87da-06dbc7633e09" AutoHideSize="300,300" DockedSize="300,300" DocumentSize="300,300" FloatingSize="300,300" Size="300,300">
- <Content xsi:type="TabbedMdiHost">
- <Content xsi:type="SplitContainer" UniqueId="0b495668-5177-4647-a0a3-18dd36e10226" AutoHideSize="300,300" DockedSize="300,300" DocumentSize="300,300" FloatingSize="300,300" Size="300,300" Orientation="Horizontal">
- <UIElement xsi:type="TabbedMdiContainer" UniqueId="55d54d10-2065-49ce-98ed-1bbae6744425" AutoHideSize="148,300" DockedSize="148,300" DocumentSize="148,300" FloatingSize="148,300" Size="148,300" SelectedWindowUniqueId="18e77b50-af61-4b29-8477-58fc56033ab6">
<UIElement xsi:type="ToolWindowRef" UniqueId="b37f4ca5-4d1b-41e7-9087-4bc84e3eaa9b" Name="documentOptionsToolWindow1" />
<UIElement xsi:type="ToolWindowRef" UniqueId="f73b79b5-a1f6-42b5-beb9-7b3af8e2ef9e" Name="documentOptionsToolWindow2" />
<UIElement xsi:type="ToolWindowRef" UniqueId="f2848d0d-9a11-4b8c-903f-6a1d49eb44f2" Name="documentOptionsToolWindow3" />
<UIElement xsi:type="ToolWindowRef" UniqueId="54fcee1d-b207-409f-bc81-102c268a95e1" Name="documentOptionsToolWindow4" />
</UIElement>
<UIElement xsi:type="TabbedMdiContainer" UniqueId="1fb3bfd7-6f25-468a-b3e7-d7c7c6ee16e3" AutoHideSize="148,300" DockedSize="148,300" DocumentSize="148,300" FloatingSize="148,300" Size="148,300" SelectedWindowUniqueId="c3855343-ade2-45b5-8c90-9bc66081a993" />
</Content>
</Content>
</UIElement>
</UIElement>
</Content>
<RaftingHosts />
- <ToolWindows>
<ToolWindow UniqueId="b37f4ca5-4d1b-41e7-9087-4bc84e3eaa9b" AutoHideSize="300,300" DockedSize="300,300" DocumentSize="300,300" FloatingSize="300,300" Size="300,300" IsOpen="true" Name="documentOptionsToolWindow1" Title="Tool window 1" LastState="Docked" State="Document" />
<ToolWindow UniqueId="f73b79b5-a1f6-42b5-beb9-7b3af8e2ef9e" AutoHideSize="300,300" DockedSize="300,300" DocumentSize="300,300" FloatingSize="300,300" Size="300,300" IsOpen="true" Name="documentOptionsToolWindow2" Title="Tool window 2" LastState="Docked" State="Document" />
<ToolWindow UniqueId="f2848d0d-9a11-4b8c-903f-6a1d49eb44f2" AutoHideSize="300,300" DockedSize="300,300" DocumentSize="300,300" FloatingSize="300,300" Size="300,300" IsOpen="true" Name="documentOptionsToolWindow3" Title="Tool window 3" LastState="Docked" State="Document" />
<ToolWindow UniqueId="54fcee1d-b207-409f-bc81-102c268a95e1" AutoHideSize="300,300" DockedSize="300,300" DocumentSize="300,300" FloatingSize="300,300" Size="300,300" IsOpen="true" Name="documentOptionsToolWindow4" Title="Tool window 4" LastState="Docked" State="Document" />
</ToolWindows>
</DockSiteLayout>
#######################################################################################

[Modified at 08/06/2010 08:59 PM]
Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
DockSiteLayoutSerializer DOES generate tool window layout to an XML string. And it can restore from an XML string too. So sorry but I'm not sure why you are asking how to do it without.


Actipro Software Support

The latest build of this product (v2018.1 build 0675) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.