Back to Devexpress

TabCloseReason Enum

blazor-devexpress-dot-blazor-93a9e34b.md

latest1.8 KB
Original Source

TabCloseReason Enum

Lists actions that close the tab.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
public enum TabCloseReason

Members

NameDescription
DeletePress

A user pressed the Delete key.

| | CloseButtonClick |

A user clicks the Close button in the tab header.

|

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

DevExpress.Blazor Namespace