DockingManager Inside DocumentContent, Is This Allowed?

Apr 12, 2011 at 11:42 AM
Edited Apr 12, 2011 at 11:50 AM

I am writing a document viewer with WPF 3.5 and the latest version of AvalonDock.

The MainWindow contains one DockManager, so that multiple documents can be open inside my program. But the problem is that a DocumentContent (represents an opened document) needs to contain DockableContent (tool pane which should only be used with this document). That is, unlike Visual Studio, the toolbox or class view is not shared among documents, but each document has its own toolbox and class view.

To do so, I wrote the following in the MainWindow

       <ad:DockingManager Background="Gray" Name="TheDockingManager">

               <ad:DocumentPane Name="TheDocumentPane">




and the following in the document view

       <ad:DockingManager Background="Gray" Name="Space">

           <ad:DocumentPane Name="TheDocumentPane" ShowHeader="False">



Since the document view contains only one document, I disabled tabs. And I put some tool panes to the document.

         TheDocumentView.IsFloatingAllowed = false;

         TheCommentInput.Show(Space, AnchorStyle.Bottom);

         TheErrorList.Show(Space, AnchorStyle.Bottom);

         TheLogFilter.Show(Space, AnchorStyle.Bottom);

At first, this seemed to work. But after trying some actions, I got frustrated due to some obscure exceptions that AvalonDock threw.

When I dragged the document view out of the MainWindow, I randomly got "A document pane can't be positioned at this level!"

When I tried to close the document view by clicking the [X] button, it randomly didn't close.

When I tried to close all documents, it threw "Unable to set active document" at the last document.


Why is it so? I am not supposed to put a DockingManager inside a DocumentContent? How should I solve the problem? The documentation in this site so poor I cannot get the details. Of course I may edit the source code since it is a open-source project to solve the problem, but if I do so, I have to do so each time new version of AvalonDock comes out.


May 4, 2011 at 12:21 PM

No direct answer to your question.

But we did it in our MEF example.

Bernard from Sofa, an AvalonDock wrapper.