Skip to main content
All docs
V24.2

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

TabCloseReason Enum

Lists actions that close the tab.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
public enum TabCloseReason

#Members

Name Description
DeletePress

A user pressed the Delete key.

CloseButtonClick

A user clicks the Close button in the tab header.

#Related API Members

The following properties accept/return TabCloseReason values:

#Remarks

You can handle the TabClosing event to process tab close actions. The event argument’s CloseReason property identifies which action closes the tab. The property returns one of the TabCloseReason enumeration values.

You can set the Cancel property to true to cancel a close action.

razor
<DxTabs TabClosing="TabClosing">
    @foreach (var employee in Employees) {
        <DxTabPage Text="@(employee.FirstName + ' ' + employee.LastName)" AllowClose="true" >
            ...
        </DxTabPage>
    }
</DxTabs>

@code {
    void TabClosing(TabCloseEventArgs args) {
        // Prevent disabled tabs from closing 
        // and disable closing tab by pressing the Delete key.
        args.Cancel = !args.TabInfo.Enabled || (args.CloseReason == TabCloseReason.DeletePress);
    }
}
See Also