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
1130
Close all panes
posted

HI, I have the following XamDockManager:

        <igDm:XamDockManager x:Name="MainDockManager" Background="{DynamicResource ApplicationBackground}">
            <igDm:DocumentContentHost>
                <igDm:SplitPane>
                    <igDm:TabGroupPane x:Name="ContentsPane" />
                </igDm:SplitPane>
            </igDm:DocumentContentHost>
        </igDm:XamDockManager>

 

The TabGroupPane is supposed to be like VS2008's main content area which hosts the designers etc.  I add to the collection using the following code:

               // content == a UserControl subclass

               pane = new ContentPane();
               pane.Content = content;
               pane.CloseAction = PaneCloseAction.RemovePane;
               ContentsPane.Items.Add( pane );
               pane.Activate();

I'm trying to implement the Close All Windows command, like in VS2008, without closing any other panes I might have.  Any ideas?

Thanks

Andy

Parents
  • 54937
    Verified Answer
    Offline posted

    You can use the GetPanes method of the XamDockManager to enumerate the panes and build a list of the documents. Then iterate that list and close the panes.

    e.g.

                Func<ContentPanebool> findDocuments = delegate(ContentPane pane) {
                    return pane.PaneLocation == PaneLocation.Document;
                };
     
                // use the func above to filter the pane enumerator to just
                // the ones that are documents
                IEnumerable<ContentPane> allDocuments = this.dockManager.GetPanes(PaneNavigationOrder.ActivationOrder).Where(findDocuments);
     
                // build a list of all the document panes
                List<ContentPane> panes = new List<ContentPane>(allDocuments);
     
                foreach (ContentPane pane in panes)
                {
                    // if you want to remove the pane completely from the dockmanager...
                    //pane.CloseAction = PaneCloseAction.RemovePane;
     
                    pane.ExecuteCommand(ContentPaneCommands.Close);
                }

     

Reply Children
No Data