.NET Framework Class Library for Silverlight
TabControl.SelectedIndex Property
Gets or sets the index of the currently selected TabItem.
Namespace: System.Windows.Controls
Assembly: System.Windows.Controls (in System.Windows.Controls.dll)
Syntax
Visual Basic (Declaration)
Public Property SelectedIndex As Integer
C#
public int SelectedIndex { get; set; }
XAML Attribute Usage
<sdk:TabControl SelectedIndex="int"/>
Property Value
Type: System.Int32The index of the currently selected TabItem, or -1 if a TabItem is not selected.
Remarks
Dependency property identifier field: SelectedIndexProperty
Examples
The following code sets the currently selected TabItem. This code is part of a larger example available in the TabControl class overview.
Visual Basic
'Set the selected TabItem of tab1 to match tab2. tab1.SelectedIndex = tab2.SelectedIndex 'You can also use SelectedItem to progamatically set the 'selected TabItem.
C#
//Set the selected TabItem of tab1 to match tab2. tab1.SelectedIndex = tab2.SelectedIndex; //You can also use SelectedItem to progamatically set the //selected TabItem.
Version Information
Silverlight
Supported in: 5, 4, 3Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
See Also