Skip to main content
Bar

TabFormControlBase.PageClosing Event

Fires when a page is about to be closed, and allows you to cancel the action.

Namespace: DevExpress.XtraBars

Assembly: DevExpress.XtraBars.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

public event PageClosingEventHandler PageClosing

Event Data

The PageClosing event's data class is DevExpress.XtraBars.PageClosingEventArgs.

Remarks

The PageClosing event fires when a page is about to be closed using the built-in close button (see TabFormControlBase.ShowTabCloseButtons), or in code using the TabFormControlBase.ClosePage method. The Page argument allows you to determine the page being closed. Set the Cancel property to true to prevent the page from being closed.

The code snippet below shows how to prevent a particular page with a custom caption from being closed.

private void tabFormControl1_PageClosing(object sender, DevExpress.XtraBars.PageClosingEventArgs e) {
    if(e.Page.Text == "Home")
        e.Cancel = true;
}

After the PageClosing event, the TabFormControlBase.PageClosed event fires, allowing you to perform custom actions if required.

See Also