windowsforms-devexpress-dot-xtratab-dot-xtratabcontrol-cfb46a2e.md
Provides access to the custom header button collection in the current tab control.
Namespace : DevExpress.XtraTab
Assembly : DevExpress.XtraEditors.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
[DXCategory("Behavior")]
public virtual CustomHeaderButtonCollection CustomHeaderButtons { get; }
<DXCategory("Behavior")>
Public Overridable ReadOnly Property CustomHeaderButtons As CustomHeaderButtonCollection
| Type | Description |
|---|---|
| CustomHeaderButtonCollection |
The CustomHeaderButtonCollection object providing access to custom header buttons for the tab control.
|
The CustomHeaderButtons property allows you to add custom buttons to a tab control. They are displayed right after tabs in the tab header. To perform actions on clicking custom header buttons, handle the XtraTabControl.CustomHeaderButtonClick event.
The tab control allows you to display also the built-in Next , Prev and Close header buttons (see the XtraTabControl.HeaderButtons topic).
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 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);
}
}
}
Imports DevExpress.XtraTab
Imports DevExpress.XtraTab.Buttons
Imports DevExpress.XtraEditors.Controls
Public Class Form1
Dim counter As Integer = 0
Private Sub XtraTabControl1_CustomHeaderButtonClick(ByVal sender As System.Object, ByVal e As DevExpress.XtraTab.ViewInfo.CustomHeaderButtonEventArgs) Handles XtraTabControl1.CustomHeaderButtonClick
If e.Button.Kind = ButtonPredefines.Plus Then
counter = counter + 1
XtraTabControl1.TabPages.Add("page" + counter.ToString)
Else
If e.Button.Kind = ButtonPredefines.Minus Then
XtraTabControl1.TabPages.Remove(e.ActivePage)
End If
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
XtraTabControl1.CustomHeaderButtons.Add(New CustomHeaderButton(ButtonPredefines.Plus))
XtraTabControl1.CustomHeaderButtons.Add(New CustomHeaderButton(ButtonPredefines.Minus))
End Sub
End Class
See Also