Skip to main content

DXTabControl.SelectionChanging Event

Occurs before the selected tab item is changed.

Namespace: DevExpress.Xpf.Core

Assembly: DevExpress.Xpf.Core.v14.2.dll

#Declaration

public event TabControlSelectionChangingEventHandler SelectionChanging

#Event Data

The SelectionChanging event's handler receives an argument of the TabControlSelectionChangingEventArgs type. The following properties provide information specific to this event:

Property Description
Cancel Gets or sets whether to cancel selecting the tab item.
NewSelectedIndex Gets the index of the currently selected tab item. Inherited from TabControlSelectionChangedEventArgs.
NewSelectedItem Gets a data item that corresponds to the currently selected tab item. Inherited from TabControlSelectionChangedEventArgs.
OldSelectedIndex Gets the index of the previously selected tab item. Inherited from TabControlSelectionChangedEventArgs.
OldSelectedItem Gets a data item that corresponds to the previously selected tab item. Inherited from TabControlSelectionChangedEventArgs.

#Remarks

Handle the SelectionChanging event to prevent selecting a tab item. To do this, set the event parameter's TabControlSelectionChangingEventArgs.Cancel property to true.

To obtain which tab item is being selected, use the DXTabControl.SelectedItem property. Its index is returned by the DXTabControl.SelectedIndex property. The index of the previously selected tab item is returned by the event parameter’s TabControlSelectionChangedEventArgs.OldSelectedIndex property. Use the DXTabControl.GetTabItem method to obtain a tab item by its index.

After a tab item has been selected, the DXTabControl.SelectionChanged event is fired.

#Examples

See Also