Skip to main content

CustomHeaderButtonCollection Class

A custom header button collection for tab controls.

Namespace: DevExpress.XtraTab.Buttons

Assembly: DevExpress.XtraEditors.v24.2.dll

Declaration

[ListBindable(false)]
public class CustomHeaderButtonCollection :
    CollectionBase

Remarks

You can add custom header buttons to an XtraTabControl and to a DocumentGroup (within a DocumentManager). The XtraTabControl.CustomHeaderButtons property allows you to add custom header buttons to an XtraTabControl. Use the IDocumentGroupProperties.CustomHeaderButtons property to add custom header buttons to a DocumentGroup. The CustomHeaderButtonCollection consists of CustomHeaderButton elements that can be accessed using indexer notation.

You can edit the CustomHeaderButtonCollection class at design time via the collection editor:

Custom Header Button Collection Editor

Example

The example demonstrates how to add two custom header buttons to a tab control and use the XtraTabControl.CustomHeaderButtonClick event to add or remove tabs.

Using Custom Header Buttons

using DevExpress.XtraTab;
using DevExpress.XtraTab.Buttons;
using DevExpress.XtraEditors.Controls;

private void Form1_Load(object sender, EventArgs e) {
    xtraTabControl1.CustomHeaderButtons.Add(new CustomHeaderButton(ButtonPredefines.Plus));
    xtraTabControl1.CustomHeaderButtons.Add(new CustomHeaderButton(ButtonPredefines.Minus));
}

int counter = 0;
private void xtraTabControl1_CustomHeaderButtonClick(object sender, DevExpress.XtraTab.ViewInfo.CustomHeaderButtonEventArgs e) {
    if (e.Button.Kind == DevExpress.XtraEditors.Controls.ButtonPredefines.Plus) {
        xtraTabControl1.TabPages.Add("page" + (++counter));
    }
    else {
        if (e.Button.Kind == DevExpress.XtraEditors.Controls.ButtonPredefines.Minus) {
            xtraTabControl1.TabPages.Remove(e.ActivePage as XtraTabPage);
        }
    }
}

Inheritance

Object
CollectionBase
CustomHeaderButtonCollection
See Also