[Version 1.x] Reload a workspace

Jul 3, 2010 at 8:58 AM
Edited Jul 3, 2010 at 12:32 PM


we are trying to reproduce the obvious behaviour of IDEs or IDE-like interfaces such as Outlook: Reload an AvalonDock based application in the same state as when previously closed (and saved).

Of course de Save/RestoreLayout helps in reloading frames. But it seems Restore as used in Demo.xaml of the AvalonDockTest project is more intended to restore the organisation of panes after they have been moved by users than to recreate panes and content when loading an application.

Did somebody work on this kind of problem? All ideas and comments about experiences will be appreciated in order to avoid us to reinvent the wheel...



Jul 4, 2010 at 11:48 AM

I answer my question ... and ask the next one.

First the answer: When it runs RestoreLayout AvalonDock does not take care of the content (DockableContent) but let you do it. How ? As said in the Getting Started in the Documentation tab:  "what happens when AvalonDock find a content that is not currently present in its [previously saved and currently reloading] layout? For this case you need to handle a specific callback method" The method is DeserializationCallback where you will be able to create or reload the "missing" content.

The question now: I create a DocumentPane with some DocumentContent inside and everything is summarized in the saved xml file by this unique tag: <DocumentPanePlaceHolder />. I undertand DockableContent is used to store some kind of permanent content such as properties or tools as DocumentContent is used for versatile documents. But, in the same way as Visual Studio and Outlook, I need to reopen all kind of contents, DockableContent as DocumentContent.

Any workaround for this ?

Thanks for your suggestions




Jul 4, 2010 at 8:05 PM


AvalonDock save/restore documents layout too: you need to set the name property for them and you should find an xml header for each document inside the <DocumentPanePlaceHolder/> node.


Jul 7, 2010 at 7:57 AM
Edited Jul 7, 2010 at 8:11 AM

Hi Ado, Thanks for your reply. I created a basic sample to make sure I don't make any error and however I set DocumentContent's names I don't get them in the saved xml file.


I am using version 1.2, .Net 3.5:




<ad:DockingManager x:Name="_dockingManager">

      <ad:ResizingPanel Orientation="Vertical">


            <ad:DockablePane ad:ResizingPanel.ResizeHeight="*">

                  <ad:DockableContent x:Name="DockableContent1">






                  <ad:DocumentContent x:Name="DocumentContent1">










   <ResizingPanel ResizeWidth="*" ResizeHeight="*" EffectiveSize="0,0" Orientation="Vertical">

       <DockablePane ResizeWidth="*" ResizeHeight="*" EffectiveSize="292,124.361666666667" Anchor="Top">

           <DockableContent Name="DockableContent1" AutoHide="false" />


       <DocumentPanePlaceHolder />


   <Hidden />

Jul 7, 2010 at 8:14 AM

Sorry but document layout persistence is a specific 1.3 feature, why don't upgrade your project?


Jul 7, 2010 at 8:44 AM
Edited Jul 7, 2010 at 8:52 AM

Edit of my previous post: I modified the DocumentPane of the sample, adding a DockableContent in a DocumentPane:



      <ad:DockableContent x:Name="DockableContentShouldNotBeThere">




      <ad:DocumentContent x:Name="DocumentContent1">




 And there the DockableContent is serialized ...

The DockableContent acts as a DocumentContent as long it is in a DocumentPane (tab on top) but keeps its Dockable possibilities (drag and drop anywhere mainly) when out of the DocumentPane.

So the solution seems to alyways use DockableContents, in DockablePanes as in DocumentPanes.

And ultimates questions: Is there any advantages I using DocumentContents rather than DockableContents, if yes in which circumstances ? And if not why is there DocumentContent ?

About your question about not upgrade to 1.3: Is 1.3 compatible with .Net 3.5. If not (and not related Avalon question): Is Visual Studio 2008 compatible with .Net 4 ?

Thanks for all !


Jul 7, 2010 at 9:02 AM

There are some differences between DocumentContents and DockableContents that can be considered relevant depending on specific project requirements.

The main difference is that when you drag a document content it can be docked only in to a border of a documentpane or into it. When docked to a documentpane border AvalonDock create another documentpane that contain the dragged document. If you drag a dockablecontent, AvalonDock creates a dockablepane instead of a document pane giving to user the ability to set the content as a flyout window.

Another difference is in the navigatorwindow, dockablecontents are shown separated on the right list.

1.3 is compatible with 3.5sp1, you have to download the 1.3 3.5sp1 build dlls.

VS 2008 is not compatible with .net 4.



Jul 7, 2010 at 9:36 AM

Our project (sofawpf.codeplex.com) uses Avalon in a special way as DockableContents and DocumentContents will never store content such as text or images but WPF UserControls (which can store text or images if they are editors for intance). So DockableContents seem to be more appropriate than DocumentContent. But we will keep the possibility to store DockableContents in DocumentPanes for users who prefer to have tabs on top.

We will switch to 1.3 / .Net 4 in the near futur but we would like to achieve a version including a full AvalonDock support before.

Thanks for your answer and this Premium support service !