Selection
The selection feature of TabControl allows you to change the current tab using click or the control's API.
The selection is controlled using the SelectedItem
and SelectedIndex
properties of RadTabControl
. The SelectedItem
should contain an item from the Items
collection of the control. The SelectedIndex
contains the collection index of the selected item.
Setting SelectedItem
this.tabControl.SelectedItem = this.tabControl.Items[1];
Setting SelectedIndex
<telerik:RadTabControl SelectedIndex="1"/>
The selection can be set also by using the IsSelected
property of RadTabItem
.
Setting IsSelected
<telerik:RadTabControl>
<telerik:RadTabItem Header="Calendar"/>
<telerik:RadTabItem Header="Colors" IsSelected="True"/>
<telerik:RadTabItem Header="Quote"/>
</telerik:RadTabControl>
Clear the Selection
To clear the selection, set the SelectedIndex property of RadTabControl
to -1
.
Clearing the selection
<telerik:RadTabControl SelectedIndex="-1"/>
Selection Behavior on Removing Tab
TabControl allows you to control the selection behavior in case the selected tab is removed. This is done using the SelectedItemRemoveBehaviour
property of RadTabControl
. The property is of type enum which provides the following values:
SelectNone
—No item is selected. Sets theSelectedItem
property tonull
.SelectFirst
—The first item in theItems
collection is selected.SelectLast
—The last item in theItems
collection is selected.SelectPrevious
—The item that is positioned before the removed one is selected.SelectNext
—The item that is positioned after the removed one is selected.
Setting SelectFirst
<telerik:RadTabControl SelectedItemRemoveBehaviour="SelectFirst"/>