DxAccordion.GetSelectedItemInfo() Method
Returns information about the selected item.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.1.dll
NuGet Package: DevExpress.Blazor
Declaration
public IAccordionItemInfo GetSelectedItemInfo()
Returns
Type | Description |
---|---|
IAccordionItemInfo | An object that contains information about the selected item. |
Remarks
The following code snippet expands a selected item if it has children:
<DxAccordion @ref=MyAccordion
SelectionMode="NavigationSelectionMode.Single"
SelectionChanged="@OnSelectionChanged">
<Items>
<DxAccordionItem Text="Shapes">
<Items>
<DxAccordionItem Text="Circle" />
<DxAccordionItem Text="Square" />
</Items>
</DxAccordionItem>
<DxAccordionItem Text="Templates" />
</Items>
</DxAccordion>
@code {
DxAccordion MyAccordion;
void OnSelectionChanged(AccordionSelectionChangedEventArgs e) {
MyAccordion.CollapseAll();
MyAccordion.ExpandToItem((x) => x == e.SelectedItems.FirstOrDefault());
if (MyAccordion.GetSelectedItemInfo().HasChildren) {
MyAccordion.SetItemExpanded((x => x.Text == e.SelectedItems.FirstOrDefault()?.Text), true);
}
}
}
See Also