Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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.2.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