Tool windows not displaying

Sep 12, 2012 at 11:20 AM

I have a problem with the dock where depending on what you do with the panes, sometimes it becomes impossible to ever display a tool window.

I was able to recreate this behaviour with the sample project:
1) drag the properties window to the document pane
2) close it
3) it will not reopen 

The code I'm using is completely different to the sample project but it's the same end result.

Does anybody have any code which can guarantee a tool window will always be displayed, no matter what has happened before?

For what it's worth this is roughly what I'm doing now

<avalonDock:LayoutPanel Orientation="Vertical">
	<avalonDock:LayoutDocumentPane x:Name="docPane"/>
	<avalonDock:LayoutAnchorablePane x:Name="bottomAnchorPane" DockHeight="220"/>
</avalonDock:LayoutPanel>


this.bottomAnchorPane.Children.Add(new LayoutAnchorable()
{
Content = xxx,
Title = yyy,
IsSelected = true,
IsActive = true
});

this.bottomAnchorPane.ComputeVisibility();

My version will break if all the documents are closed before anything is added to the bottom pane.

p.s. incredible project, good job...

Sep 12, 2012 at 1:27 PM

LayoutAnchorablePane/LayoutDocumentPane are continuously created and destroyed at runtime as the user arrange the layout.
You should not base your code on xaml x:name attribute because it will point to an object that could be removed from layout at runtime.

So for example above the bottomAnchorPane could be removed if for some reason it will become empty.

I don’t know what are your specifications but you could find an anchorable pane that is located at the bottom of the documents area using a code like this (not tested):

var bottomAnchorPane  = dockManager.Layout.Descendents().OfType<LayoutAnchorablePane>().FirstOrDefault(p => p.GetSide() == AnchorSide.Bottom);

Also consider that you can use the LayoutAnchorable.AddToLayout() method to insert a content in specific position,

Ado

Sep 12, 2012 at 7:55 PM

I think the AddToLayout is exactly what I needed.

Thanks!