Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxButtonGroupItem.Selected Property

In single or multiple selection mode, specifies whether the processed item is selected.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[DefaultValue(false)]
[Parameter]
public bool Selected { get; set; }

#Property Value

Type Default Description
Boolean false

true if the processed item is selected; otherwise, false.

#Remarks

The <DxButtonGroup> component allows you to select and deselect button group items. Set the DxButtonGroup.SelectionMode property to Single or Multiple to enable selection.

The Selected property specifies the item’s selection state. To respond to the property change, handle the SelectedChanged event.

The following code snippet sets the component’s selection mode to Single and displays the current selection state of the Admin button group item:

Razor
<p>Is item selected - @IsItemSelected</p>

<DxButtonGroup RenderStyle="ButtonRenderStyle.Secondary"
               RenderStyleMode="ButtonRenderStyleMode.Outline"
               SelectionMode="ButtonGroupSelectionMode.Single">
    <Items>
        <DxButtonGroupItem Text="Admin"
                           Selected="@IsItemSelected"
                           SelectedChanged="@OnSelectedChanged"/>
        <DxButtonGroupItem Text="Editor" />
        <DxButtonGroupItem Text="Guest" />
    </Items>
</DxButtonGroup>

@code {
    bool IsItemSelected = false;

    void OnSelectedChanged(bool isSelected) {
        IsItemSelected = isSelected;
    }
}
See Also