Jun 8, 2009 at 4:30 PM

I am receiving the following error when I try and save the layout...

"Unable to serialize docking layout while DockingManager control is unloaded"  There were discussions on this topic, but the resolution wasn't clear to me.

Can someone tell me the guidelines for Saving the Layout?  i.e.  All elements must have a Name tag?

Thanks in advance!

Jun 8, 2009 at 4:41 PM

Here is what I came up with; fire an event after the docking manager loads...

 dockingManager.Loaded += new RoutedEventHandler(dockingManager_Loaded);

Handle all my saving fine.


Now restore is my issue:  I receive an error:

"Specified argument was out of the range of valid values. Parameter name: index"


Jun 9, 2009 at 7:05 AM

All of your DockableContent must have the names!!! See the following example

  <ad:DockingManager Grid.Row="2" Name="dockMngr" Loaded="dockMngr_Loaded">
            <ad:ResizingPanel Orientation="Vertical">
                <ad:ResizingPanel Orientation="Horizontal">
                    <ad:DockablePane MinWidth="150" ad:ResizingPanel.ResizeWidth="150">
                        <ad:DockableContent Title="Navigation Tree" Name="_navigationTree">
                                    <RowDefinition Height="200*" />
                                    <RowDefinition Height="79.388*" />
                                <TreeView Name="treeViewNavigation" Grid.Row="0"/>
                                <Expander Grid.Row="1" Header="Описание" Margin="0,0,0,0" Name="DetailsExpander" IsExpanded="True">
                                    <TextBox MinHeight="30" Name="DetailsTextBlock" IsReadOnly="True" Width="Auto" TextWrapping="WrapWithOverflow" VerticalScrollBarVisibility="Auto" />
                        <ad:DockableContent Title="Main Area" Name="_mainArea">
                            <ad:DocumentPane x:Name="documentsHost">
                                <ad:DockableContent Title="File1.doc">
                                <ad:DockableContent Title="File2.doc">
                <ad:DockablePane ad:ResizingPanel.ResizeHeight="150">
                    <ad:DockableContent Title="Журналы" Name="_logs">
                            <TabItem Header="Журнал событий">
                                <dg:DataGrid Name="dataGridEventLog" Style="{StaticResource DataGridStyle}">
                            <TabItem Header="Системный журнал">
                                <dg:DataGrid Name="dataGridSysLog" Style="{StaticResource DataGridStyle}">


        private void dockMngr_Loaded(object sender, RoutedEventArgs e)

        void LoadLayout()
            string path = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
                + @"\layout.xml";
            if (!File.Exists(path))
                Debug.Assert(false, "Отсутствует xml-файл, содержащий layout");
                if (dockMngr != null)
            catch (System.Exception e)

Jun 20, 2009 at 9:34 AM
Edited Jun 20, 2009 at 9:35 AM

I found in AvalonDockTest Sample, after RestoreLayout, some autoHide Dockpanel such as server explorer can't to be floating!

who can make the sample  AvalonDockTest  to work correct?