Skip to main content
A newer version of this page is available. .

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

Selects the specified item.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v22.2.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.

The example below 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

To remove selection, call the ClearSelection() method.

See Also