Skip to main content
All docs
V24.2

DxButtonGroup.SelectionMode Property

Specifies the item selection mode.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(ButtonGroupSelectionMode.None)]
[Parameter]
public ButtonGroupSelectionMode SelectionMode { get; set; }

Property Value

Type Default Description
ButtonGroupSelectionMode None

An enumeration value.

Available values:

Name Description
None

Users cannot select items.

Single

Users can select one item.

Multiple

Users can select multiple items.

Remarks

The <DxButtonGroup> component supports item selection. Use the SelectionMode property to specify the selection mode. The default mode is None – users cannot select button group items.

Set the SelectionMode property to Single or Multiple to enable single or multiple item selection. To select specific items in code, set their DxButtonGroupItem.Selected properties to true. To respond to property changes, handle corresponding DxButtonGroupItem.SelectedChanged events.

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

<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