Skip to main content
All docs
V25.1
  • TabCloseReason Enum

    Lists actions that close the tab.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    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.

    <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