Skip to main content
All docs
V25.1
  • AccordionSelectionChangedEventArgs.Reason Property

    Returns the reason why the Accordion item’s selection state changed.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    public NavigationItemStateChangeReason Reason { get; }

    Property Value

    Type Description
    NavigationItemStateChangeReason

    A NavigationItemStateChangeReason enumeration value.

    Available values:

    Name Description
    ApiCall

    The state changes programmatically.

    UserAction

    The state changes by user action.

    UrlMatch

    The state changes as a result of URL matching.

    Remarks

    The following example expands to the Square item if it was selected from code:

    <DxButton Click=@OnClick>Expand</DxButton>
    
    <DxAccordion @ref="@MyAccordion"
                 SelectionMode="NavigationSelectionMode.Single"
                 SelectionChanged="@OnSelectionChanged"
                 RootItemExpandButtonDisplayMode="AccordionExpandButtonDisplayMode.None">
        <Items>
            <DxAccordionItem Text="Shapes">
                <Items>
                    <DxAccordionItem Text="Circle" />
                    <DxAccordionItem Text="Square" />
                </Items>
            </DxAccordionItem>
            <DxAccordionItem Text="Templates" />
        </Items>
    </DxAccordion>
    
    @code {
        DxAccordion MyAccordion;
        void OnClick() {
            MyAccordion.SelectItem(x => x.Text == "Square");
        }
        void OnSelectionChanged(AccordionSelectionChangedEventArgs args) {
            if (args.Reason == NavigationItemStateChangeReason.UserAction) {
                MyAccordion.ExpandToItem(x => x == args.SelectedItems.FirstOrDefault());
            }
        }
    }
    

    Expand and Select

    See Also