Version

MoveAllTabs Method

Moves all of the tabs in the group to the relative TabGroup.
Syntax
'Declaration
 
Public Sub MoveAllTabs( _
   ByVal relation As MdiTabGroupPosition _
) 
public void MoveAllTabs( 
   MdiTabGroupPosition relation
)

Parameters

relation
Relative MdiTabGroup that should contain the tabs contained by the group
Remarks

The MoveAllTabs method may be used to move all the Tabs to another MdiTabGroup. The relation is used to indicate which MdiTabGroup should receive the new MdiTab objects and is based on the order of the MdiTabGroup objects in the TabGroups of the owning Manager.

Note: Depending upon the relation specified, the tabs may not be moved. For example, if the tab group is the first item in the TabGroups collection and a relation of First is specified, then nothing will change because the relation points to the same MdiTabGroup.

Example
The following example demonstrates some of the ways for repositioning MdiTab objects.

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinTabs
Imports Infragistics.Win.UltraWinTabbedMdi

Private Sub MoveAllToFirstGroup()
    'There are multiple ways to reposition a group. Which you use
    'will depend upon what you are trying to accomplish although
    'there are usually several mechanisms for achieving the 
    'desired result. Here we are moving all the tabs from all
    'the tab groups into the first tab group. Several numbered
    'but commented out ways are presented to complete the task.
    '

    ' if there are no mdi tab groups, there is nothing to do
    If Not Me.ultraTabbedMdiManager1.HasTabGroups Then
        Return
    End If

    ' get the first group
    Dim firstGroup As MdiTabGroup = Me.ultraTabbedMdiManager1.TabGroups(0)
    Dim firstDisplayedTab As MdiTab = firstGroup.FirstDisplayedTab
    Dim selectedTab As MdiTab = firstGroup.SelectedTab

    Me.ultraTabbedMdiManager1.BeginUpdate()

    ' iterate through all the tab groups after
    ' the first one and move the tabs to the first group.
    ' we'll iterate backwards since removing all the tabs 
    ' in a group causes the group to get removed
    '
    Dim count As Integer = Me.ultraTabbedMdiManager1.TabGroups.Count - 1

    Dim i As Integer
    For i = count To 1 Step - 1
        Dim tabGroup As MdiTabGroup = Me.ultraTabbedMdiManager1.TabGroups(i)

        ' (1) The MoveAllTabs method is convenient to move all 
        ' the contained tabs to an existing tabgroup. the
        ' MdiTabGroupPosition parameter is used to determine
        ' the tab group which tab group, relative to the 
        ' calling tab group's current position
        'tabGroup.MoveAllTabs(MdiTabGroupPosition.First)

        ' The alternative is to iterate the tabs (backwards
        ' since moving the tab to a different group will
        ' remove it from the tabs collection of the containing
        ' group)
        Dim j As Integer
        For j = tabGroup.Tabs.Count - 1 To 0 Step - 1
            Dim tab As MdiTab = tabGroup.Tabs(j)

            ' (2) The Reposition method will take a tab object
            ' and move the invoking tab to the same tab group 
            ' as the specified tab and positioned relative to that tab
            '
            'tab.Reposition(firstGroup.SelectedTab, MdiTabPosition.Last)

            ' (3) Calling the MoveToGroup without specifying an index
            ' will move the tab to the specified group and position 
            ' it at the end. This is equivalent to calling:
            'tab.MoveToGroup(firstGroup, firstGroup.Tabs.Count)
            tab.MoveToGroup(firstGroup)
        Next

    Next

    ' reset the previously selected tab
    firstGroup.SelectedTab = selectedTab

    ' reinitialize the tab was previously the first displayed tab
    firstGroup.FirstDisplayedTab = firstDisplayedTab

    Me.ultraTabbedMdiManager1.EndUpdate()
End Sub
using Infragistics.Win;
using Infragistics.Win.UltraWinTabs;
using Infragistics.Win.UltraWinTabbedMdi;

private void MoveAllToFirstGroup()
{
	// There are multiple ways to reposition a group. Which you use
	// will depend upon what you are trying to accomplish although
	// there are usually several mechanisms for achieving the 
	// desired result. Here we are moving all the tabs from all
	// the tab groups into the first tab group. Several numbered
	// but commented out ways are presented to complete the task.
	// 

	// if there are no mdi tab groups, there is nothing to do
	if (!this.ultraTabbedMdiManager1.HasTabGroups)
		return;

	// get the first group
	MdiTabGroup firstGroup = this.ultraTabbedMdiManager1.TabGroups[0];
	MdiTab firstDisplayedTab = firstGroup.FirstDisplayedTab;
	MdiTab selectedTab = firstGroup.SelectedTab;

	this.ultraTabbedMdiManager1.BeginUpdate();

	// iterate through all the tab groups after
	// the first one and move the tabs to the first group.
	// we'll iterate backwards since removing all the tabs 
	// in a group causes the group to get removed
	//
	int count = this.ultraTabbedMdiManager1.TabGroups.Count - 1;

	for(int i = count; i > 0 ; i--)
	{
		MdiTabGroup tabGroup = this.ultraTabbedMdiManager1.TabGroups[i];

		// (1) The MoveAllTabs method is convenient to move all 
		// the contained tabs to an existing tabgroup. the
		// MdiTabGroupPosition parameter is used to determine
		// the tab group which tab group, relative to the 
		// calling tab group's current position
		tabGroup.MoveAllTabs(MdiTabGroupPosition.First);

		// The alternative is to iterate the tabs (backwards
		// since moving the tab to a different group will
		// remove it from the tabs collection of the containing
		// group)
		for(int j = tabGroup.Tabs.Count - 1; j >= 0; j--)
		{
			MdiTab tab = tabGroup.Tabs[j];

			// (2) The Reposition method will take a tab object
			// and move the invoking tab to the same tab group 
			// as the specified tab and positioned relative to that tab
			//
			tab.Reposition(firstGroup.SelectedTab, MdiTabPosition.Last);

			// (3) Calling the MoveToGroup without specifying an index
			// will move the tab to the specified group and position 
			// it at the end. This is equivalent to calling:
			tab.MoveToGroup(firstGroup, firstGroup.Tabs.Count);
			tab.MoveToGroup(firstGroup);
		}

	}

	// reset the previously selected tab
	firstGroup.SelectedTab = selectedTab;

	// reinitialize the tab was previously the first displayed tab
	firstGroup.FirstDisplayedTab = firstDisplayedTab;

	this.ultraTabbedMdiManager1.EndUpdate();
}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also