I have a simple XDM with a DocumentContentHost, SplitPane, and TabGroupPane. If I programmatically add a ContentPane to the TabGroupPane, then drag it to float (I believe you call this a ToolWindow), and then dock it again (to the right), why when I iterate the XDM.Panes collection is that docked SplitPane in the collection twice? The first reference has a location of Floating (via GetPaneLocation), and the second DockedRight.
I came upon this when I wanted to iterate panes and determine if any were floating. Is GetPaneLocation the most straightforward way? Google produced a link to some documentation with an IsFloating property, but that property appears to be obsolete.
I'm using 12.1. Thanks.
Hello Darryl,
Thank you for your post. I have been looking into it and I created a sample project following your scenario and by using XDM’s GetPanes method everything seems to work ok on my side. If the sample doesn’t satisfies all your needs feel free to modify it, so it reproduces your behavior and send it back to me for further investigation.
Looking forward for your reply.
Hi Stefan, thanks for the response. Please change button2_Click to count the Panes collection, to see root panes:
MessageBox.Show(xamDockManager1.Panes.Count().ToString());
Then, drag one ContentPane to float, and click button2 and see count 1. Then drag it back and dock it on the right and click button2 again, to see count 2. If you were to get the location on each of those, you would see "Floating" and "DockedRight" respectively, but they appear to refer to the same SplitPane. It's as if there's a latent reference to the SplitPane when it was floating, though now docked.
This is not a show-stopper for me. I can get what I want other ways, but it does make me curious, and I thought you guys might want to know about it.
This is actually the correct and expected behavior. SplitPane and TabGroupPane instances are never moved. So when you drag one of your ContentPane instances from the DocumentContentHost (or more accurately out from within a TabGroupPane within the DocumentContentHost) to be floating, a new SplitPane is created and added to the Panes collection of the XDM. It's PaneLocation is Floating and it contains a ContentPane. When you then drag that ContentPane to be docked to an edge of the XDM, a new SplitPane is created (since the pane isn't being dragged into an existing docked SplitPane or TabGroupPane) and added to the Panes collection. The floating SplitPane remains. It actually contains a ContentPanePlaceholder; i.e. a special element that represents where the pane would be when it is toggled back to the floating state. So for example, if you double click on the caption of that pane, it will toggle back to that floating splitpane and the SplitPane will be displayed. The docked SplitPane would remain and it would contain a ContentPanePlaceholder whose Pane was that ContentPane. That would remain there until it was no longer needed - e.g. if you drag that floating ContentPane to be docked somewhere else within the XDM. The public GetPanes method that Stefan mentioned is the recommended means of enumerating the ContentPane instances that exist within the XamDockManager. You may also enumerate the Panes collection of the XDM and down into the descendant elements but then you must be aware that you can encounter SplitPane, TabGroupPane, ContentPane or ContentPanePlaceholder instances.
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
You may disregard my last statement, since after playing with the caption doubclick, and re-reading your post, I see that at most I would have two splitpanes for a contentpane repeatedly docked and floated. No root "pain", actually very cool.
Thank you for the detailed answer. This is indeed a very complex component. Your answer further explains why I was able to add a new contentpane to the floating splitpane, then invisible, and it again became visible, afloat with the new contentpane. Didn't know about the double-click functionality. I'll have to check that out.
I am however now wondering about resource consumption, given the fact that I've designed my app to allow numerous panes to be floated/docked at will.
Best,
Darryl