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
210
How to programmatically consolidate ContentPanes into one TabGroupPane?
posted

After the user changed the layout/configuration of the TabGroupPane and created some ContentPanes in many TabGroupPanes, how to programmatically consolidate ContentPanes in multiple TabGroupPanes into one TabGroupPane?

  • 28407
    posted

    HI Frankwwu,

     I have code snippet below that will consolidate contentpanes from one group to another.

     Here a help link on TabGroups:

     http://help.infragistics.com/NetAdvantage/WPF/2010.2/CLR4.0/?page=InfragisticsWPF4.DockManager.v10.2~Infragistics.Windows.DockManager.TabGroupPane.html

     

     

    private void Button_Click(object sender, RoutedEventArgs e)

    {

     

     

    for (int i = tg2.Items.Count - 1; i > -1; i--)

    {

     

     

    ContentPane cp = (ContentPane) tg2.Items[i];

     

    tg2.Items.RemoveAt(i);

     

    tg1.Items.Add(cp);

    }

     

    }

     Sincerely,
     Matt
     Developer Support Engineer

    • 28407
      posted in reply to [Infragistics] Matt Traynor

      .

      • 210
        posted in reply to [Infragistics] Matt Traynor

        Thank you for the link. I still can't make it work. Here is my code snip:

         

         

         

         

         

         

         

         

         

         

         

         

         

         

         

         

         

         

         

         

         

        public

         

         

        class ContentPaneFactory : Infragistics.Windows.Extensions.

        ContentPaneFactory

        {

         

         

         

        public ContentPaneFactory()

        {

        ConsolidateCommand =

         

        new DelegateCommand(Consolidate, CanConsolidate);

         

         

         

        GlobalCommands.ConsolidateTabsCommand.RegisterCommand(ConsolidateCommand);

        }

        #region

         

         

        ConsolidateCommand

         

         

         

        public DelegateCommand ConsolidateCommand { get; private set; }

         

         

         

        private void Consolidate()

        {

         

         

         

        if (_target is DocumentContentHost

        )

        {

         

         

         

        DocumentContentHost dch = _target as DocumentContentHost;

         

         

         

        for (int i = dch.Panes.Count - 1; i >= 0; i--)

        {

         

         

         

        SplitPane sp = dch.Panes[i];

        ConsolidateSplitPane(sp);

        }

        }

         

         

         

        else if (_target is SplitPane

        )

        {

         

         

         

        SplitPane sp = _target as SplitPane;

        ConsolidateSplitPane(sp);

        }

        }

         

         

         

        protected void ConsolidateSplitPane(SplitPane sp)

        {

         

         

         

        TabGroupPane tgpKeep = sp.Panes[0] as TabGroupPane

        ;

         

         

         

        for (int j = 1; j < sp.Panes.Count; j++)

        {

         

         

         

        TabGroupPane tgp = sp.Panes[j] as TabGroupPane;

         

         

         

        for (int

        k = 0; k < tgp.Items.Count; k++)

        {

         

         

         

        ContentPane cp = tgp.Items[k] as ContentPane;

        tgp.Items.RemoveAt(k);

        tgpKeep.Items.Add(cp);

        }

        }

        }

         

         

         

        private bool

        CanConsolidate()

        {

         

         

         

        return true;

        }

        #endregion

        }

        Not sure if I understand correctly about the visual tree.

         

         

         

        Thanks,

        Frank 

        • 28407
          posted in reply to [Infragistics] Matt Traynor

          HI,

           I am just following up on this forum thead.

           Do you need further assistance regarding this issue?

           If you do, please let me know.

           Sincerely,
           Matt
          Developer Support Engineer