I have the following code to programatically add a new split pane witht content. Once the user close the pane, it stays in the collection. How can I remove it from the xamDockManagerMain.Panes collection. I tried remove but that does not seem to actually remove it. I need to either remove it so that it can be re-added, or how to you display it again once it has been hidden?
SplitPane sp = new SplitPane();sp.Name = "sp" + chatUser + WindowCount.ToString();ContentPane cp = new ContentPane();sp.Panes.Add(cp);cp.Name = "cp" + _screenName + WindowCount.ToString();cp.Header = "Chat " + _screenName + " and " + chatUser;//cp.CloseAction = PaneCloseAction.RemovePane;ChatWindow cw = new ChatWindow(_aimSession, _screenName, chatUser);cw.MinHeight = 100;cw.MinWidth = 100;cp.Content = cw;XamDockManager.SetFloatingLocation(sp, new Point(20, 20));XamDockManager.SetFloatingSize(sp, new Size(200, 200));XamDockManager.SetInitialLocation(sp, InitialPaneLocation.DockableFloating);xamDockManagerMain.Panes.Add(sp);
If the CloseAction is left to the default - HidePane - then when the pane is closed (e.g. clicking the X in the pane header) its Visibility is set to Collapsed. To reshow the pane you would just set its Visibility back to Visible. When the CloseAction is RemovePane and the user clicks the close button or you execute the ContentPaneCommands.Close on the ContentPane, the pane as well as any placeholders for alternate positions of the pane (docked, floating, document) will be removed from the xamDockManager so if you want to remove the pane completely, set the CloseAction as such and use the ExecuteCommand method of the pane with the ContentPaneCommands.Close command.
HI,
The close action is the default with is to collapse, but when I call the visible the window does not come back. Does it have anything to do with it being a floating window?
Setting the Visibility of the ContentPane to Visible should show the floating window again. In my tests, it has worked. If you still get a problem perhaps you can post a small sample that shows the problem?
I had experienced the same issue and the only way that I was able to get it to work reliably was to set the visibility on both the content and the splitpane for the floating window. This solution worked for both floatingonly and dockablefloating splitpanes.
Upon doing some more testing with this issue using the 8.3 hotfix it seems that if a floating splitpane is set as collapsed on startup setting the contentpane visibility does not show. But if you set the splitpane visibility to visible once then it works as expected. I am attaching a demo of this behavior. Upon startup of the demo app click the "Non-Working Show Floating Window" button to show that the content is not shown and then click the "Working Show Floating Window" button to show the content. Once the second button has been pressed if you close the floatingonly window the second button no longer will open the window but the first one will. If you remove the comment for setting the visibility on the contentpane in the second button the window will always show.
Hope this helps.
Thanks for the sample but how did the SplitPane start off with a Collapsed visibility? The xamDockManager never explicitly sets the Visibility of the SplitPane or TabGroup - it only coerces it to collapsed when it has no visible contentpanes - so it would never set it back to Visible. We decided that if you were to explicitly set the Visibility of a SplitPane/TabGroup that that should be honored so that wouldn't be a bug. If however the Visibility of the SplitPane somehow was set to Collapsed by the xamDockManager then that would be a bug. If you feel it would be worthwhile to have a means to force a ContentPane to be made visible then a suggestion could be entered for adding a method/command to the ContentPane to do that - or perhaps a setting to let it know to do this should it or a child element request to be brought into view.
I am not really sure why you would set the SplitPane visibility at all but I think the issue at hand may have been with the last version of the control (possibly before hotfix 8.3 or even with the 8.1 version) I had the same issues and that was the only way that I could work around the issue. I don't have the previous versions installed anymore so I was not able to create the original issue exactly myself. This was the only way that I could possibly make this issue apparent. I see that I should now be able go back through my current code and remove all references to setting the visibility on the splitpane. :)
Thanks