XtraTabControl.SelectedTabPage Property
Gets or sets the currently selected tab page.
Namespace: DevExpress.XtraTab
Assembly: DevExpress.XtraEditors.v22.2.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
[DefaultValue(null)]
[DXCategory("Behavior")]
public virtual XtraTabPage SelectedTabPage { get; set; }
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;
}