I wrote an application that uses one XamDockManager with a bunch of panes. I also used the great LoadLayout(() and SaveLayout() methods.
Everything works, except this scenario:
1) A user floats one of the ContentPanes and ends the application. I call SaveLayout() before ending the application.
2) When the user starts the application again, I call LoadLayout(), but the ContentPane that was floated on the previous run only appears for a couple of seconds and then disappears (while it's visible, it's at the correct position)
Is this a bug? If it's not, what am I doing wrong?
I copy below the original XAML, the saved XML and the relevant code-behind - in my example below, the "Action Items" ContentPane ("dcpActionItems") is the one that floats and becomes invisible after I call SaveLayout() and then LoadLayout(().
-----------------------------------------------------------------------------------------------------------Original window.xaml (before layout changes)-----------------------------------------------------------------------------------------------------------
<igDock:XamDockManager HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" x:Name="xdmDockManager" Theme="Generic"> <igDock:XamDockManager.Resources> <ResourceDictionary> [... XAML deleted for simplicity ...] </ResourceDictionary> </igDock:XamDockManager.Resources> <igDock:XamDockManager.Panes> <igDock:SplitPane x:Name="dspNOTRELEVANT1" igDock:XamDockManager.InitialLocation="DockedRight"> <igDock:ContentPane x:Name="dcpNOTRELEVANT1" Header="NOTRELEVANT1" AllowClose="False" AllowFloatingOnly="True" AllowDocking="True" AllowDrop="False" AllowPinning="True" > <Grid> [... XAML deleted for simplicity ...] </Grid> </igDock:ContentPane> </igDock:SplitPane> </igDock:XamDockManager.Panes> <igDock:DocumentContentHost> <igDock:SplitPane x:Name="dspNOTRELEVANT3" SplitterOrientation="Horizontal"> <igDock:TabGroupPane x:Name="dtgpActionItems"> <igDock:ContentPane x:Name="dcpActionItems" Header="Action Items" AllowClose="False" AllowFloatingOnly="True" AllowDocking="True" AllowDrop="False" AllowPinning="True" > <Grid> [... XAML deleted for simplicity ...] </Grid> </igDock:ContentPane> </igDock:TabGroupPane> <igDock:TabGroupPane x:Name="dtgpNOTRELEVANT2"> <igDock:ContentPane x:Name="dcpNOTRELEVANT2" Header="NOTRELEVANT2" AllowClose="False" AllowFloatingOnly="True" AllowDocking="True" AllowDrop="False" AllowPinning="True"> <Grid> [... XAML deleted for simplicity ...] </Grid> </igDock:ContentPane> </igDock:TabGroupPane> </igDock:SplitPane> </igDock:DocumentContentHost> </igDock:XamDockManager>
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------Code behind-----------------------------------------------------------------------------------------------------------
Sub LoadLayout() Dim fs As New FileStream(cLAYOUTSETTINGSFILENAME, FileMode.Open, FileAccess.Read) Me.xdmDockManager.LoadLayout(fs) End Sub Sub SaveLayout() Dim fs As New FileStream(cLAYOUTSETTINGSFILENAME, FileMode.Create, FileAccess.Write) Me.xdmDockManager.SaveLayout(fs) End Sub
----------------------------------------------------------------------------------------------------------- Layout Settings XML ("Action Items" not floating - same as original XAML above) -----------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?><xamDockManager version="9.1.20091.1006"> <contentPanes> <contentPane name="dcpNOTRELEVANT1" location="Document" /> <contentPane name="dcpActionItems" location="Document" /> <contentPane name="dcpNOTRELEVANT2" location="DockedRight" /> </contentPanes> <panes> <splitPane name="dspNOTRELEVANT2" splitterOrientation="Vertical" location="DockedRight" extent="367.76"> <contentPane name="dcpNOTRELEVANT2" /> </splitPane> </panes> <documents splitterOrientation="Vertical"> <splitPane name="dspNOTRELEVANT3" splitterOrientation="Horizontal"> <tabGroup name="dtgpActionItems" selectedIndex="0" relativeSize="100,108.247022902351"> <contentPane name="dcpActionItems" /> </tabGroup> <tabGroup name="dtgpNOTRELEVANT1" selectedIndex="0" relativeSize="100,91.7529770976487"> <contentPane name="dcpNOTRELEVANT1" /> </tabGroup> </splitPane> </documents></xamDockManager>
----------------------------------------------------------------------------------------------------------- Layout Settings XML ("Action Items" floating - LoadLayout(() does not work) -----------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?><xamDockManager version="9.1.20091.1006"> <contentPanes> <contentPane name="dcpNOTRELEVANT1" location="Document" lastActivatedTime="2009-04-22T00:47:16.8288078Z" /> <contentPane name="dcpActionItems" location="Floating" lastFloatingSize="622,189" lastFloatingWindowRect="72,265,638,223" lastFloatingLocation="72,265" lastActivatedTime="2009-04-22T00:47:08.419967Z" /> <contentPane name="dcpNOTRELEVANT2" location="DockedRight" lastActivatedTime="2009-04-22T00:41:43.0194302Z" /> </contentPanes> <panes> <splitPane name="dspNOTRELEVANT2" splitterOrientation="Vertical" location="DockedRight" extent="367.76"> <contentPane name="dcpNOTRELEVANT2" /> </splitPane> <splitPane name="Z92282895671f4e8a934a31cfb2439509" splitterOrientation="Vertical" location="Floating" floatingLocation="72,265" floatingSize="622,189"> <contentPane name="dcpActionItems" /> </splitPane> </panes> <documents splitterOrientation="Vertical"> <splitPane name="dspNOTRELEVANT3" splitterOrientation="Horizontal"> <tabGroup name="dtgpActionItems" selectedIndex="-1" relativeSize="100,108.247022902351" /> <tabGroup name="dtgpNOTRELEVANT1" selectedIndex="0" relativeSize="100,91.7529770976487"> <contentPane name="dcpNOTRELEVANT1" /> </tabGroup> </splitPane> </documents></xamDockManager>
I was calling LoadLayout() in the Loaded() event; I'm now calling it in the ctor and it works!
My project is a bit complicated, so it'll be hard to send you the full XAML - but in this case the XamDockManager is nested within multiple Grids, etc...
I tried this out and wasn't able to reproduce the issue (even when loading the xml you provided that you indicated was not working in your situation. When were you calling LoadLayout? In my test I tried in the Window's ctor and I also tried in the loaded event. What is the ancestor chain for the dockmanager? I.e. is it directly within the window or within some other controls?