Version

SelectedTab Property

Returns or sets the currently selected MdiTab in the group
Syntax
'Declaration
 
Public Property SelectedTab As MdiTab
public MdiTab SelectedTab {get; set;}
Remarks

The SelectedTab represents the tab that currently appears as selected in the tab group. The different in appearance will depend upon the resolved TabStyle as well as the appearance settings of the MdiTabSettings. The TabSettings can be used to initialize the default appearances for the Tabs. The appearance of the SelectedTab will be resolved using the SelectedTabAppearance.

The SelectedTab may also represent the ActiveTab since the ActiveTab must be the SelectedTab of the tab group that contains it. Setting the SelectedTab will cause the TabSelecting event to be invoked. If not cancelled, the tab will be selected and the TabSelected event will be invoked.

Note: This property will return null if the Tabs is empty or for an MdiTabGroup that contains other MdiTabGroups instances in its TabGroups.

Note: When this property is set, an exception is generated if the specified MdiTab is not in the Tabs collection.

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