XtraTabControl.SelectedTabPage Property

Gets or sets the currently selected tab page.

Namespace: DevExpress.XtraTab

Assembly: DevExpress.XtraEditors.v20.1.dll

Declaration

[DXCategory("Behavior")]
[DefaultValue(null)]
public virtual XtraTabPage SelectedTabPage { get; set; }
<DXCategory("Behavior")>
<DefaultValue(Nothing)>
Public Overridable Property SelectedTabPage As XtraTabPage

Property Value

Type Default Description
XtraTabPage

null

An XtraTabPage object which represents the tab page currently selected.

Remarks

Read this property's value to determine which tab page is currently selected. Assign a tab page to this property to select it.

Disabled tab pages (pages whose XtraTabPage.Enabled property is set to false) cannot be selected. If the tab control does not own any pages, the SelectedTabPage property returns a null reference.

When the SelectedTabPage property value changes, the XtraTabControl.SelectedPageChanged event raises.

The code sample below illustrates how switch active tabs with CTRL+1 and CTRL+2 key combinations.


xtraTabControl1.KeyDown += XtraTabControl1_KeyDown;

private void XtraTabControl1_KeyDown(object sender, KeyEventArgs e)
{
    if (e.KeyCode == Keys.D1 && e.Control)
        this.xtraTabControl1.SelectedTabPage = xtraTabPage1;
    if (e.KeyCode == Keys.D2 && e.Control)
        this.xtraTabControl1.SelectedTabPage = xtraTabPage2;
}
See Also