Hi,
We are using Persistent Layout feature. We are using DockSiteLayoutSerializer to serialize / de-serialize and save / load docksite layout.
What I have found that after loading saved layout the docksite tree structure is changed.
Below is my sample xaml file:
<DockPanel LastChildFill="True">
<Button x:Name="SnapToDefault" Content="Snap" DockPanel.Dock="Top" Click="SnapToDefault_Click"></Button>
<Button x:Name="LoadLayout" Content="LoadyLayout" DockPanel.Dock="Top" Click="LoadLayout_Click"></Button>
<docking:DockSite x:Name="dockSite">
<docking:SplitContainer x:Name="splitContainer">
<docking:ToolWindowContainer x:Name="toolWindowContainer" docking:DockSite.ControlSize="75,75" >
<docking:ToolWindow x:Name="toolWindow1" Title="Test_Tool_Window_1" CanMaximize="False"/>
<docking:ToolWindow x:Name="toolWindow2" Title="Test_Tool_Window_2" CanMaximize="False"/>
</docking:ToolWindowContainer>
</docking:SplitContainer>
</docking:DockSite>
</DockPanel>
While debugging found out that after loading saved layout toolWindowContainer parent become null and even toolWindow1 will not recognize itself as child of toolWindowContainer.
If we do not load layout than this control hierarchy and relationship sustain.
We can check this in WPF Tree Visualizer that before loading layout the tree structure is same as defined in xaml file but after loading it is not able to find tool windows, containers and there relation.
If this hierarchy is changed than this will create issues in Automation Testing.
I have attached a sample to demonstrate this issue.
In this sample there are two toolwindows as mentioned in above xaml and two buttons “Snap” and “LoadLayout”.
On click of snap we try to dock toolWindow1 in its parent(toolWindowContainer) and on click of “LoadLayout” we load last saved layout.
If we first click on snap without loading layout it will work fine and toolWindow1 will get docked at bottom of toolWindowContainer.
But if we first click on “LoadLayout” and then on “Snap” in this case it is throwing exception as toolWindowContainer parent is null. Also if we add toolWindowContainer in childs of splitContianer than also this docking is not working.
Behavior we want is that: after loading saved layout the visual tree hierarchy of docksite should remain same and all the controls should maintain their parent/child relationship.
Please suggest what we are missing. We need fix for this urgently.
Thanks,
Piyush