New to Telerik UI for WinUI? Download free 30-day trial

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 the SelectedItem property to null.

  • SelectFirst—The first item in the Items collection is selected.

  • SelectLast—The last item in the Items 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"/> 

See Also

In this article
Not finding the help you need?