Imports Infragistics.Windows.Controls
Private Sub ExecuteCommands()
' This command will select the first selectable tab, ignoring tabs
' that are not visible or enabled
Me.XamTabControl1.ExecuteCommand(TabControlCommands.SelectFirstTab)
' This command will select the next selectable tab, ignoring tabs
' that are not visible or enabled
Me.XamTabControl1.ExecuteCommand(TabControlCommands.SelectNextTab)
' This command will select the previous selectable tab, ignoring tabs
' that are not visible or enabled
Me.XamTabControl1.ExecuteCommand(TabControlCommands.SelectPreviousTab)
' This command will select the last selectable tab, ignoring tabs
' that are not visible or enabled
Me.XamTabControl1.ExecuteCommand(TabControlCommands.SelectLastTab)
' This command will close all tabs, i.e. set their Visibility property
' to 'Collapsed'. To unclose the tabs set their Visibility back to
' 'Visible' (see code in btnUncloseAllTabs_Click event handler below)
Me.XamTabControl1.ExecuteCommand(TabControlCommands.CloseAll)
' This command will close the selcted tab if he XamTabControl's
' 'AllowTabClosing' property is not set and is not overridden
' via the TabItemEx's 'AllowClosing' property.
Me.XamTabControl1.ExecuteCommand(TabControlCommands.CloseSelected)
' This command will expand a minimized XamTabControl. The command
' is disabled if the 'IsMinimized' property is false.
If (Me.XamTabControl1.IsMinimized = True) Then
Me.XamTabControl1.ExecuteCommand(TabControlCommands.Expand)
End If
' This command will minimize a XamTabControl. The command
' is disabled if the 'IsMinimized' property is true or the
' 'AlowMinimize' property is false.
If (Me.XamTabControl1.IsMinimized = False AndAlso Me.XamTabControl1.AllowMinimize = True) Then
Me.XamTabControl1.ExecuteCommand(TabControlCommands.Minimize)
End If
' This command will toggle the value of the 'IsMinimized' property.
' The command is disabled if the 'AlowMinimize' property is false.
If (Me.XamTabControl1.AllowMinimize = True) Then
Me.XamTabControl1.ExecuteCommand(TabControlCommands.ToggleMinimized)
End If
End Sub
Private Sub btnUncloseAllTabs_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
Dim count As Int32 = Me.XamTabControl1.Items.Count
Dim generator As ItemContainerGenerator = Me.XamTabControl1.ItemContainerGenerator
Dim tabItem As TabItem
' loop over all the tab items in the XamTabControl and set their
' Visibility property to 'Visibile' to un-close them.
For i As Int32 = 0 To count - 1
tabItem = TryCast(generator.ContainerFromIndex(i), TabItem)
If Not tabItem Is Nothing Then
tabItem.Visibility = Visibility.Visible
End If
Next
End Sub