blazor-devexpress-dot-blazor-93a9e34b.md
Lists actions that close the tab.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
public enum TabCloseReason
| Name | Description |
|---|---|
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:
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