Skip to main content

XtraTabControl.TabMiddleClick Event

Fires when an end-user presses the middle mouse button over a tab. To ensure that this event fires, set the XtraTabControl.TabMiddleClickFiringMode property to MouseDown or MouseUp.

Namespace: DevExpress.XtraTab

Assembly: DevExpress.XtraEditors.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DXCategory("Behavior")]
public event PageEventHandler TabMiddleClick

Event Data

The TabMiddleClick event's data class is DevExpress.XtraTab.ViewInfo.PageEventArgs.

Remarks

By default, the TabMiddleClick event doesn’t fire. To make it fire, set the XtraTabControl.TabMiddleClickFiringMode property to MouseDown or MouseUp.

You can handle the TabMiddleClick event to perform custom actions on tabs when clicking them with the middle mouse button. For instance, you can close tabs.

Example

This example shows how to close tab pages on clicking the middle mouse button. This is accomplished by setting the XtraTabControl.TabMiddleClickFiringMode property to MouseDown and handling the XtraTabControl.TabMiddleClick event.

private void Form1_Load(object sender, EventArgs e) {
    xtraTabControl1.TabMiddleClickFiringMode = DevExpress.XtraTab.TabMiddleClickFiringMode.MouseDown;
}

private void xtraTabControl1_TabMiddleClick(object sender, DevExpress.XtraTab.ViewInfo.PageEventArgs e) {
    xtraTabControl1.TabPages.Remove((XtraTabPage)e.Page);
}
See Also