This project is read-only.

[Version 1.3] problem with showing hidden dockable content

Jun 16, 2011 at 4:07 PM
Edited Jun 16, 2011 at 4:10 PM


I have a problem with showing hidden dockable content.

I'm using this code:

        <ad:DockingManager Grid.Row="1" Name="dockingManager">
            <ad:ResizingPanel Orientation="Vertical">
                    <ad:ResizingPanel Name="RP1" Orientation="Vertical" ad:ResizingPanel.ResizeWidth="250">
                        <ad:DockablePane Name="DP1">
                            <ad:DockableContent Name="DC1" Title="Content 1" StateChanged="DC1_StateChanged" />
                        <ad:DockablePane Name="DP2">
                            <ad:DockableContent Name="DC2" Title="Content 2" StateChanged="DC2_StateChanged" />
                        <ad:DocumentContent Name="Doc1" Title="Document 1">
                <ad:ResizingPanel ad:ResizingPanel.ResizeHeight="150">
                        <ad:DockableContent Name="DC3" Title="Content 3" StateChanged="DC3_StateChanged" />

The problem is when I hide DC1 and DC2 by calling



and then try to show the DC1 again by calling DC1.Show(); it doesn't appear.


Then if I call DC2.Show(); both DC1 and DC2 are appeared.

The same isuue if try to show first the DC2

How to make the DC1 be shown without showing the DC2?

Jun 20, 2011 at 1:57 PM

I found a way to fix the problem.

Here is the workaround (in the DockingManager):

        internal void Show(DockableContent content, DockableContentState desideredState, AnchorStyle desideredAnchor)
                    if (content.SavedStateAndPosition != null &&
                        content.SavedStateAndPosition.ContainerPane != null &&
                        content.SavedStateAndPosition.ChildIndex >= 0 &&
                        content.SavedStateAndPosition.ContainerPane.GetManager() == this &&
                        desideredState == DockableContentState.Docked)
/* new call */		content.SetStateToDock();//moved here from the end of the block

                        //ok previous container pane is here..
                        Pane prevPane = content.SavedStateAndPosition.ContainerPane;

                        if (content.SavedStateAndPosition.ChildIndex < prevPane.Items.Count)
                            prevPane.Items.Insert(content.SavedStateAndPosition.ChildIndex, content);

                        if (prevPane.Items.Count == 1)
                            if (!double.IsNaN(content.SavedStateAndPosition.Width) ||
                                    new GridLength(content.SavedStateAndPosition.Width));

                        DockablePane prevDockablePane = prevPane as DockablePane;
                        if (prevDockablePane != null && prevDockablePane.IsAutoHidden)

/* old call */          //content.SetStateToDock(); //UL: moved up
                        (prevPane.Parent as UIElement).InvalidateMeasure();


Aug 1, 2011 at 5:39 PM

I had a similar problem.  It took me a day to figure it out.  Here is my test case

      <ad:DockingManager x:Name="dockManager" Grid.Row="1">
            <ad:ResizingPanel Orientation="Vertical">
                <ad:ResizingPanel Orientation="Horizontal">
                  <ad:DocumentContent Title="MyDocument!" x:Name="MyDocumentContent"/>
                  <ad:DockableContent Title="MyDocument DockablePane!" x:Name="MyDockablePane"/>

When I call MyDockablePane.Show(), the pane disappears.  So, when I debug the code, I found out the state of the MyDockablePane is set to None.  And, I think this is a bug.
To workaround the problem, I call ShowAsDocument() to set the state to Document.  And, it fixes the problem.  I do believe there is a bug in the AvalonDock that the state 
is not set correctly.  And, I think your walkaround will fix the problem.  Let us hope they will fix the problem.