ToolWindowsTabPlacement setting is lost during save & load

Docking/MDI for WPF Forum

Posted 5 years ago by Markus Duus - ServiceTrace GmbH
Version: 13.2.0592
Platform: Silverlight Controls
Environment: Windows 7 (64-bit)
Avatar

After saving & loading my Docking Layout, the ToolWindowsTabPlacement settings set on a single ToolWindowContainer is lost and reset to Bottom. This is my XAML Code (I removed the contents and some event handlers for better readability):

<docking:DockSite x:Name="DockSite" 
                          Grid.Row="2"  
                          HorizontalAlignment="Stretch" 
                          VerticalAlignment="Stretch"
                          UseHostedAutoHidePopups="False"
                          CanDocumentWindowsRaft="True"
                          CanDocumentWindowsDragToLinkedDockSites="True"
                          AreDocumentWindowsDestroyedOnClose="False">
            <docking:DockSite.Switcher>
                <docking:StandardSwitcher AreToolWindowsVisible="False" />
            </docking:DockSite.Switcher>

            <docking:DockSite.ToolWindowTransitionSelector>
                <docking:ToolWindowTransitionSelector/>
            </docking:DockSite.ToolWindowTransitionSelector>

            <docking:DockSite.AutoHideRightContainers>
                <docking:ToolWindowContainer >
                    <docking:ToolWindow x:Name="PropertiesWindow" 
                                        Title="Properties">
                                        <!-- Snip -->
                    </docking:ToolWindow>
                </docking:ToolWindowContainer>
            </docking:DockSite.AutoHideRightContainers>
            
            <docking:SplitContainer Orientation="Vertical">
                <docking:SplitContainer>
                    <docking:ToolWindowContainer x:Name="ToolBoxContainer"
                                                 docking:DockSite.ToolWindowsTabPlacement="Top" 
                                                 docking:DockSite.ControlSize="330,0">

                        <docking:ToolWindow x:Name="ProjectExplorerWindow"
                                            Title="Project Explorer">
                            <!-- Snip -->
                        </docking:ToolWindow>

                        <docking:ToolWindow x:Name="RepositoryExplorerWindow"
                                            Title="Repository Explorer">
                            <!-- Snip -->
                        </docking:ToolWindow>

                        <docking:ToolWindow x:Name="DocumentOutlineWindow" 
                                            Title="Document Outline">
                            <!-- Snip -->
                        </docking:ToolWindow>

                        <docking:ToolWindow x:Name="ToolboxWindow"
                                            Title="Toolbox">
                            <!-- Snip -->
                        </docking:ToolWindow>
                        
                    </docking:ToolWindowContainer>

                    <docking:Workspace>
                        <docking:TabbedMdiHost x:Name="DocumentsHost"
                                               IsImageOnTab="True"
                                               CanDocumentsCloseOnMiddleClick="True">
                            <docking:TabbedMdiContainer x:Name="DocumentsContainer" 
                                                        SelectionChanged="DocumentsContainer_SelectionChanged"
                                                        TabOverflowBehavior="ShrinkWithMenu">
                                <docking:DocumentWindow x:Name="StartPageWindow"
                                                        Title="Start Page">
                                                        <!-- Snip -->
                                </docking:DocumentWindow>
                            </docking:TabbedMdiContainer>
                        </docking:TabbedMdiHost>
                    </docking:Workspace>
                </docking:SplitContainer>

                <docking:ToolWindowContainer>
                    <docking:ToolWindow x:Name="ScriptrunresultsWindow" 
                                        Title="Script Run Results">
                        <!-- Snip -->
                    </docking:ToolWindow>
                </docking:ToolWindowContainer>
            </docking:SplitContainer>
            
        </docking:DockSite>

 Note that the "ToolBoxContainer" has the ToolWindowsTabPlacement set to Top.

Serializing this Layout leads to this XML:

<DockSiteLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SerializationFormat="ToolWindowsOnly">
	<AutoHideHost>
		<AutoHideTabStrip Side="Right">
			<ToolWindowContainer AutoHideSize="200,200" DockedSize="200,200" DocumentSize="200,200" FloatingSize="200,200" Size="200,200" SelectedWindowUniqueId="27bb42c8-a3db-4a0e-ae82-f9371dc2a6c4">
				<UIElement xsi:type="ToolWindowRef" UniqueId="27bb42c8-a3db-4a0e-ae82-f9371dc2a6c4" />
			</ToolWindowContainer>
		</AutoHideTabStrip>
	</AutoHideHost>
	<Content xsi:type="SplitContainer" AutoHideSize="753,485" DockedSize="753,485" DocumentSize="753,485" FloatingSize="753,485" Size="753,485" Orientation="Vertical">
		<UIElement xsi:type="SplitContainer" AutoHideSize="753,280" DockedSize="753,280" DocumentSize="753,280" FloatingSize="753,280" Size="753,280" Orientation="Horizontal">
			<UIElement xsi:type="ToolWindowContainer" AutoHideSize="330,280" DockedSize="330,280" DocumentSize="330,280" FloatingSize="330,280" Size="330,280" SelectedWindowUniqueId="b78d89b4-7a1f-49e7-a72f-27dee45ef65a">
				<UIElement xsi:type="ToolWindowRef" UniqueId="b78d89b4-7a1f-49e7-a72f-27dee45ef65a" />
				<UIElement xsi:type="ToolWindowRef" UniqueId="b04d5034-395a-4fac-a32d-99c949de840c" />
				<UIElement xsi:type="ToolWindowRef" UniqueId="07b3776f-3d57-4e1e-9f67-f4416061f073" />
				<UIElement xsi:type="ToolWindowRef" UniqueId="00a642ab-7310-4ab1-93ad-af253e3839d1" />
			</UIElement>
			<UIElement xsi:type="Workspace" AutoHideSize="418,280" DockedSize="418,280" DocumentSize="418,280" FloatingSize="418,280" Size="418,280">
				<Content xsi:type="TabbedMdiHost">
					<Content xsi:type="TabbedMdiContainer" AutoHideSize="418,280" DockedSize="418,280" DocumentSize="418,280" FloatingSize="418,280" Size="418,280" SelectedWindowUniqueId="2223e158-2c90-42bd-8818-23f6b85a12a2" />
				</Content>
			</UIElement>
		</UIElement>
		<UIElement xsi:type="ToolWindowContainer" AutoHideSize="753,200" DockedSize="753,200" DocumentSize="753,200" FloatingSize="753,200" Size="753,200" SelectedWindowUniqueId="1dc35db6-aa78-4efe-985d-2f891bccff8c">
			<UIElement xsi:type="ToolWindowRef" UniqueId="1dc35db6-aa78-4efe-985d-2f891bccff8c" />
		</UIElement>
	</Content>
	<ToolWindows>
		<ToolWindow UniqueId="27bb42c8-a3db-4a0e-ae82-f9371dc2a6c4" AutoHideSize="350,0" DockedSize="200,200" DocumentSize="350,0" FloatingSize="350,0" Size="350,0" IsOpen="true" LastState="Docked" Name="PropertiesWindow" StandardMdiBounds="0,0,300,200" State="AutoHide" />
		<ToolWindow UniqueId="b78d89b4-7a1f-49e7-a72f-27dee45ef65a" AutoHideSize="330,200" DockedSize="330,280" DocumentSize="330,200" FloatingSize="330,200" Size="330,280" IsOpen="true" LastState="Docked" Name="ProjectExplorerWindow" StandardMdiBounds="0,0,300,200" State="Docked" />
		<ToolWindow UniqueId="b04d5034-395a-4fac-a32d-99c949de840c" AutoHideSize="330,200" DockedSize="330,280" DocumentSize="330,200" FloatingSize="330,200" Size="330,280" IsOpen="true" LastState="Docked" Name="RepositoryExplorerWindow" StandardMdiBounds="0,0,300,200" State="Docked" />
		<ToolWindow UniqueId="07b3776f-3d57-4e1e-9f67-f4416061f073" AutoHideSize="330,200" DockedSize="330,280" DocumentSize="330,200" FloatingSize="330,200" Size="330,280" IsOpen="true" LastState="Docked" Name="DocumentOutlineWindow" StandardMdiBounds="0,0,300,200" State="Docked" />
		<ToolWindow UniqueId="00a642ab-7310-4ab1-93ad-af253e3839d1" AutoHideSize="330,200" DockedSize="330,280" DocumentSize="330,200" FloatingSize="330,200" Size="330,280" IsOpen="true" LastState="Docked" Name="ToolboxWindow" StandardMdiBounds="0,0,300,200" State="Docked" />
		<ToolWindow UniqueId="1dc35db6-aa78-4efe-985d-2f891bccff8c" AutoHideSize="200,200" DockedSize="753,200" DocumentSize="200,200" FloatingSize="200,200" Size="753,200" IsOpen="true" LastState="Docked" Name="ScriptrunresultsWindow" StandardMdiBounds="0,0,300,200" State="Docked" />
	</ToolWindows>
</DockSiteLayout>

 And finally, after loading the XML using this code:

new DockSiteLayoutSerializer().LoadFromString(layout, DockSite); 

 Everything is restored correctly, but the Tabs of "ToolBoxContainer" are now on the bottom side.

 

I noted that I can warkaround this issue by setting the ToolWindowsTabPlacement Option on the DockSite itself, but then all Tabs of all ToolWindowContainers are on the top. Which isn't too bad, but this should be saved & loaded correctly nonetheless.

 

Best Regards

Comments (1)

Answer - Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Markus,

That actually is by design.  You should never be setting properties directly on "containers" since they are created/destroyed dynamically as the user moves docking windows around the layout.  For instance if the user dragged all the tool windows out of the container where you set that property directly, that container might get destroyed and then if the tool windows were docked again together elsewhere, they would not have tabs on top.

As you saw, you should instead be setting DockSite.ToolWindowsTabPlacement to manage the tab placement settings for tool windows.  That will provide consistency across all the tool windows.


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.