Skip to main content
A newer version of this page is available. .

XtraTabControl.TabPages Property

Provides access to the tab control’s page collection.

Namespace: DevExpress.XtraTab

Assembly: DevExpress.XtraEditors.v18.2.dll

Declaration

[DXCategory("Behavior")]
public virtual XtraTabPageCollection TabPages { get; }

Property Value

Type Description
XtraTabPageCollection

An XtraTabPageCollection object which represents a collection of tab pages within a tab control.

Remarks

The code sample below illustrates how to close all tab pages except the active page.


xtraTabControl1.MouseClick += XtraTabControl1_MouseClick;

private void XtraTabControl1_MouseClick(object sender, MouseEventArgs e)
{
    XtraTabControl tabControl = sender as XtraTabControl;
    if (e.Button == MouseButtons.Right)
    {
        tabControl.ContextMenuStrip = new ContextMenuStrip();
        tabControl.ContextMenuStrip.Items.Add("Close all other tabs");
        tabControl.ContextMenuStrip.Items[0].Click += XtraForm3_CloseAllOtherTabs;
        tabControl.ContextMenuStrip.Show();
    }
}

private void XtraForm3_CloseAllOtherTabs(object sender, EventArgs e)
{
    XtraTabPage page = xtraTabControl1.SelectedTabPage;
    xtraTabControl1.TabPages.Clear();
    xtraTabControl1.TabPages.Add(page);
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the TabPages property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also