Skip to main content

DxAccordion.SelectionChanged Event

Fires when a collection of selected Accordion items changes.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public EventCallback<AccordionSelectionChangedEventArgs> SelectionChanged { get; set; }

Event Data

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

Property Description
DeselectedItems Returns a collection of previously selected items. Inherited from NavigationSelectionChangedEventArgs<TInfo>.
Reason Returns the reason why the Accordion item’s selection state changed.
SelectedItems Returns a collection of currently selected items. Inherited from NavigationSelectionChangedEventArgs<TInfo>.

Remarks

Handle the SelectionChanged event to react to selection changes.

The following code snippet gets previously and currently selected items:

<DxAccordion SelectionMode="NavigationSelectionMode.Single" 
             SelectionChanged="@OnSelectionChanged">
    <Items>
        <DxAccordionItem Text="Shapes">
            <Items>
                <DxAccordionItem Text="Circle" />
                <DxAccordionItem Text="Square" />
            </Items>
        </DxAccordionItem>
        <DxAccordionItem Text="Templates" />
    </Items>
</DxAccordion>

Selected item: @SelectedItem
<br /> Deselected item: @DeselectedItem

@code {
    string SelectedItem { get; set; }
    string DeselectedItem { get; set; }
    void OnSelectionChanged(AccordionSelectionChangedEventArgs e) {
        SelectedItem = e.SelectedItems.FirstOrDefault()?.Text;
        DeselectedItem = e.DeselectedItems.FirstOrDefault()?.Text;
    }
}

SelectionChanged

See Also