Skip to main content

DxAccordion.SelectItem(Func<IAccordionItemInfo, Boolean>) Method

Selects the specified item.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

public void SelectItem(
    Func<IAccordionItemInfo, bool> predicate
)

Parameters

Name Type Description
predicate Func<IAccordionItemInfo, Boolean>

A delegate method that specifies a particular item.

Remarks

If item selection is enabled, you can use the SelectItem method to select an item from code. This method does not select the specified item in bound mode if Load Child Items on Demand mode is enabled and the item is not loaded yet. If none of the items meet the specified condition, the component does not clear selection. Call the ClearSelection() method to deselect items.

The following code snippet implements the selection button:

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

<DxButton Click="@OnClick">Select item</DxButton>

@code {
    DxAccordion MyAccordion;
    void OnClick() => MyAccordion.SelectItem(x => x.Text == "Templates");
}

Select Item Button

See Also