Skip to main content
All docs
V25.1
  • DxButtonGroupItem.SelectedChanged Event

    Fires when the item’s Selected property changes.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    [DefaultValue(false)]
    [Parameter]
    public EventCallback<bool> SelectedChanged { get; set; }

    Parameters

    Type Description
    Boolean

    A new Selected property value.

    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.

    Handle the SelectedChanged event to respond to the item’s Selected property change.

    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