SelectedIndex Property
Collapse the table of content
Expand the table of content

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)

public int SelectedIndex { get; set; }
<sdk:TabControl SelectedIndex="int"/>

Property Value

Type: System.Int32
The index of the currently selected TabItem, or -1 if a TabItem is not selected.

Dependency property identifier field: SelectedIndexProperty

The following code sets the currently selected TabItem. This code is part of a larger example available in the TabControl class overview.

//Set the selected TabItem of tab1 to match tab2.
tab1.SelectedIndex = tab2.SelectedIndex;
//You can also use SelectedItem to progamatically set the 
//selected TabItem.


Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

© 2016 Microsoft