Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1090
Adding/Removing content panes
posted

Hey,

I have a few questions related to adding and removing content panes:

What is the best way to programmatically add a content pane as a tabbed document?  Currently i have a SplitPane with a TabGroupPane set up in my xaml.  When I want to add a new content pane in code I just do something like defaultTabGroupPane.Items.Add(myContentPane).  Is see that there is a method exposed on the xam dock manager to add documents, should I be using the method instead?

Is there a way to programmatically add a content pane to the same tab group as an existing content pane?  ie somehow determine where the existing content pane is and add another pane to that location?  Can it be done both when the existing pane is a tabbed document and when the pane is a dockable, floating tool window?

 Is using the ContentPaneCommands.Close command the best way to programmatically remove a content pane from the dock manager? 

 

Thanks

Parents
No Data
Reply
  • 54937
    Verified Answer
    Offline posted

    jlotridge said:
    What is the best way to programmatically add a content pane as a tabbed document?  Currently i have a SplitPane with a TabGroupPane set up in my xaml.  When I want to add a new content pane in code I just do something like defaultTabGroupPane.Items.Add(myContentPane).  Is see that there is a method exposed on the xam dock manager to add documents, should I be using the method instead?

    Its up to you. If the TabGroupPane has a name then it will remain in the tree even if the end user moves all the panes out of it so you can add to it but the other documents may have been moved. The AddDocument method follows VS' behavior of adding the document to the beginning of the tab group that contains the active document.

    jlotridge said:
    Is there a way to programmatically add a content pane to the same tab group as an existing content pane?  ie somehow determine where the existing content pane is and add another pane to that location?

    There is no generic way to do this. You may want to submit a suggestion for adding an "AddSibling" method to the ContentPane. For now, you would probably have to get the logical parent of the ContentPane and special case for the various parents (splitpane, tabgrouppane, etc.).

    jlotridge said:
    Can it be done both when the existing pane is a tabbed document and when the pane is a dockable, floating tool window?

    I'm not exactly sure I follow this question. If you mean that it should be a sibling of the pane whereever it has been (i.e. if its been floated and its currently docked to the left that it be a sibling of it when its floated and a sibling in its docked position) then no there is currently no way to do this.

    jlotridge said:
     Is using the ContentPaneCommands.Close command the best way to programmatically remove a content pane from the dock manager?

    Yes but be aware that this uses the CloseAction which by default is to hide the pane. If you want to completely remove the pane from the xdm then you will have to change the closeaction to removepane and then close it. We'll look to add a method to the ContentPane in a future build.

Children