Back to Devexpress

DxAccordion.BeforeCollapse Event

blazor-devexpress-dot-blazor-dot-dxaccordion-618ebc69.md

latest2.1 KB
Original Source

DxAccordion.BeforeCollapse Event

Fires when an item is about to be collapsed and allows you to cancel the action.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
[Parameter]
public Action<AccordionItemCancelEventArgs> BeforeCollapse { get; set; }

Event Data

The BeforeCollapse event's data class is AccordionItemCancelEventArgs. The following properties provide information specific to this event:

PropertyDescription
CancelSpecifies whether the action that raised the event should be canceled.
CausedByAPIObsolete. Specifies whether an event was triggered by user action or from code. Inherited from AccordionItemStateChangeEventArgs.
ItemInfoReturns information about an item related to the event. Inherited from AccordionItemEventArgs.
ReasonReturns the reason why the Accordion item’s expanded state changed. Inherited from AccordionItemStateChangeEventArgs.

Remarks

The following code snippet cancels the collapse action for root-level nodes:

razor
<DxAccordion BeforeCollapse="@BeforeCollapse">
    @* ... *@
</DxAccordion>

@code {
    void BeforeCollapse(AccordionItemCancelEventArgs args) {
        if (args.ItemInfo.Level == 0) args.Cancel = true;
    }
}

See Also

DxAccordion Class

DxAccordion Members

DevExpress.Blazor Namespace