Skip to main content
All docs
V26.1
  • DxAccordionDataMappingBase.Selected Property

    Maps a data source field that specifies whether an Accordion item is selected.

    Namespace: DevExpress.Blazor.Base

    Assembly: DevExpress.Blazor.v26.1.dll

    Declaration

    [DefaultValue(null)]
    [Parameter]
    public string Selected { get; set; }

    Property Value

    Type Default Description
    String null

    The field name.

    Remarks

    The Selected property maps a Boolean field from your data source to the selected state of Accordion items. When the mapped field value is true, the corresponding item is selected.

    Note

    To allow selection, set the SelectionMode property to NavigationSelectionMode.Single.

    The following code snippet maps the IsSelected field to the initial selected state of an Accordion item:

    <DxAccordion Data="@Products" SelectionMode="NavigationSelectionMode.Single">
        <DataMappings>
            <DxAccordionDataMapping Text="Name"
                                    Selected="IsSelected"
                                    Children="Children" />
        </DataMappings>
    </DxAccordion>
    
    @code {
        List<Product> Products { get; set; } = new() {
            new Product {
                Name = "Desktop UI Controls",
                Children = new() {
                    new Product { Name = "WinForms" },
                    new Product { Name = "VCL (Delphi & C++Builder)" }
                }
            },
            new Product {
                Name = "Utilities",
                IsSelected = true,
                Children = new() {
                    new Product {
                        Name = "WinForms Skin Editor"
                    }
                }
            }
        };
    }
    

    When a user selects an item, the component does not update the corresponding field in the data source. Handle the SelectionChanged event to update the data source programmatically.

    See Also