1
Vote

Children structures do not work properly.

description

Let's say that I have this project:
 
 
LayoutDocumentPane centralLayout = new LayoutDocumentPane();
LayoutAnchorGroup leftLayout = new LayoutAnchorGroup();
LayoutAnchorGroup rightLayout = new LayoutAnchorGroup();
LayoutAnchorGroup topLayout = new LayoutAnchorGroup();
LayoutAnchorGroup bottomLayout = new LayoutAnchorGroup();
LayoutRoot layoutRoot = new LayoutRoot();
LayoutPanel layoutPanel = new LayoutPanel();
LayoutDocumentPaneGroup pg = new LayoutDocumentPaneGroup();
pg.Children.Add(centralLayout);

layoutPanel.Children.Add(pg);
layoutRoot.RootPanel = layoutPanel;
dockManager.Layout = layoutRoot;
 
LayoutAnchorSide l = new LayoutAnchorSide();
l.Children.Add(leftLayout);
layoutRoot.LeftSide = l;
 
LayoutAnchorSide r = new LayoutAnchorSide();
r.Children.Add(rightLayout);
layoutRoot.RightSide = r;
 
LayoutAnchorSide t = new LayoutAnchorSide();
t.Children.Add(topLayout);
layoutRoot.TopSide = t;
 
LayoutAnchorSide b = new LayoutAnchorSide();
b.Children.Add(bottomLayout);
layoutRoot.BottomSide = b;
 
Then I insert five LayoutAnchorables
 
                    centralLayout.Children.Add(doc1);
                    leftLayout.Children.Add(doc2);
                    rightLayout.Children.Add(doc3);
                    bottomLayout.Children.Add(doc4);
                    topLayout.Children.Add(doc5);
 
The thing is, I cannot figure out how detecting when a window is closed. I thought registering my layoutAnchorables on a list and then when a propertychange event rises, and checking the list and the LayoutAnchorGroups or layoutroot children would do the trick!, but it did not. The number of children changes when I able and disable “autohide”. If I close a windows “layoutroot” children grows! I think that internal Registers must be reviewed. Although I understand that it is beta, maybe the authors did not notice this behavior.
 
Thanks, and good job

comments

adospace wrote May 29, 2012 at 11:59 AM

Hum, I don't know which is the issue here. The LayoutRoot children collection can increase if you hide windows when the Hidden group is automatically created. Also this can happen if you float an anchorable for the first time.

Could you please explain better what you're trying to achive? and also please use this section to post reproducible issues only, thx

cvilachap wrote May 30, 2012 at 7:58 AM

Well, what I see is dockingmanager.layoutrood.children grows when I close panels. In fact, in my case I have 5 LayoutAnchorables, and when I close all, dockingmanager.layoutrood.childrenoncount says 8.

adospace wrote May 30, 2012 at 12:23 PM

yes, because hidden anchorables became children of the root, if you close them instead of hide you should see that root children count is not changed

cvilachap wrote May 31, 2012 at 1:01 PM

As I said, I close the panels.

adospace wrote Jun 1, 2012 at 7:22 PM

Hi, sorry I was not clear. I suppose you clicked the x button. Doing so you only hide the panes, which means that the anchorables are removed from main layout and are placed niside the Hidden collection (becoming in this way children of the LayoutRoot). If you instead click the Close menu item you explitely remove any reference to the anchorables object.
Please let me know If you need more info
Thanks,
Ado