Selecting Tab Items
- 2 minutes to read
Users can click item headers to navigate between tab items. When a user clicks an item header, this item becomes selected and the DXTabControl displays item content. Use the following properties to obtain or specify the selected item:
- DXTabControl.SelectedContainer
- Gets or sets the selected DXTabItem.
- DXTabControl.SelectedItem
- Gets or sets an object from the
ItemsSource
collection that is the selected tab item. - DXTabControl.SelectedIndex
- Gets or sets an index of the selected tab item.
- DXTabControl.SelectedValue
Gets or sets the selected item’s value from the data source field specified by the
DXTabControl.SelectedValuePath
property.Works similar to the
DXTabControl.SelectedItem
property if theDXTabControl.SelectedValuePath
property is not specified.- DXTabItem.IsSelected
- Gets or sets whether the tab item is selected.
If one of the selection properties is changed, other properties will be updated accordingly.
If selection has been changed (by either end-user interaction or changes to the items source), the tab control raises the DXTabControl.SelectionChanged event.
DXTabControl also provides the DXTabControl.SelectionChanging event that allows you to cancel selection changes. This event is only raised if the selection is changed via the tab control (for instance when a user selects a tab item). If the selection is changed directly by setting one of the selection properties or through a binding, the DXTabControl.SelectionChanging event does not occur. In this case, you need to manage changes of the selection properties and cancel them if necessary in your code.
To programmatically change selection, use the DXTabControl.SelectNext and DXTabControl.SelectPrev methods.