[VERSION 2.0] - I'm just not smart enough to figure this out!!

Aug 12, 2012 at 4:36 AM
Edited Aug 12, 2012 at 4:37 AM

I have been playing with Avalon Dock for a week and need help understanding the hierarchy and dependencies.  If I start out with the following xaml starting with the dockManager?
<Layout Panel Orientation="Horizontal" />

How do I programmatically (c#)  add:
1.  A LayoutAnchorable to the right side?
2.  A LayoutDocument to the center?
3.  A LayoutAnchorable to the left side?
4.  A LayoutAnchorable to the same AnchorablePane as 1. was inserted, even if it was moved to the bottom?
5.  A Layout Document to a different LayoutDocumentPane as the one added in 2?

6.  If I have four LayoutDocuments in a LayoutDocumentPane, how do I selectively hide two of them? 

Any help would really be appreciated.


Aug 16, 2012 at 3:58 PM

When a layoutAnchorable is closed (by pressing the "x" in the tab) what event is fired?  I can't seem to catch it with the closed event.

Aug 16, 2012 at 4:46 PM

I just took a look at the code, and it seems the Closed event is never called when the LayoutAnchorable (specifically it's base class, LayoutContent) is closed.

Aug 16, 2012 at 5:22 PM


The LayoutAnchorableItem.HideCommand is fired. (note the "Item"). The Hide Command is not available in the LayoutAnchorable.



Aug 17, 2012 at 2:04 PM

To create a LayoutDocument programmatically, I am:

 if (doc==null)
 doc=new LayoutDocument();
 doc.Title = "something"
 //get a list of all LayoutDocumentPanes
 bool found = false;
 foreach (LayoutDocumentPane ldpitm in ldplst)
  //see if there is one in the category that I want.
  IEnumerable<LayoutDocument> ldlist = ldpitm.Descendents().OfType<LayoutDocument>();
  foreach (LayoutDocument lditm in ldlist)
   //if there is add the new doc to the pane
   if (lditm.ContentId == e.VM.ContentId)
    //add this doc to this pane
    found = true;
 //if not, create a new pane for the document.
 if (!found)
  //we need to create a document pane 
  LayoutDocumentPane ldp = new LayoutDocumentPane();

The reason I am doing this is because LayoutDocumentPane does not appear to have a Name attribute like LayoutAnchorablePane, yet both LayoutAnchorablePane and LayoutDescendentPane appear to be required parents of LayoutAnchorable.  Is this correct?

Having created the LayoutDocument programmatically, I now would like to remove then programmatically (or replace them under certain conditions).  For that, I want to either close the documentPane (by firing the "x" event (whatever that is) to simulate manually closing the document), or simply hiding the documentPane, but it appears that the LayoutDocument.IsVisible is readonly.  So currently, I can see no way to programmatically close or hide a layoutDocument.

Is there another strategy that I can utilize?