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

CustomHeaderButtonCollection Class

A custom header button collection for tab controls.

Namespace: DevExpress.XtraTab.Buttons

Assembly: DevExpress.XtraEditors.v18.1.dll

Declaration

[ListBindable(false)]
[TypeConverter(typeof(UniversalCollectionTypeConverter))]
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);
        }
    }
}

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

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.

Inheritance

Object
CollectionBase
CustomHeaderButtonCollection
See Also