Skip to main content
All docs
V25.1
  • Toggle Button Group

    The Toggle Button Group (ToggleButtonGroup) is a set of two-state buttons that can be toggled on or off.

    Toggle Button Group - WinForms UI Templates, DevExpress

    Add Toggle Buttons

    Use the Items property to manage toggle buttons within the group. You can add, remove, and re-arrange buttons as needed.

    using DevExpress.UITemplates.Collection.Editors;
    
    toggleButtonGroup1.Items.AddRange(new ButtonGroupItem[] {
        new ButtonGroupItem(1, "Option A"),
        new ButtonGroupItem(2, "Option B"),
        new ButtonGroupItem(3, "Option C")
    });
    

    Toggle Button Size

    Use the ItemSize property to specify the size of toggle buttons.

    Size Screenshot
    Small Small Toggle Button - WinForms UI Templates, DevExpress
    Default Default Toggle Button - WinForms UI Templates, DevExpress
    Large Large Toggle Button - WinForms UI Templates, DevExpress

    Selection

    Use the Selection and SelectedValues properties to obtain selected/pressed buttons and values.

    // Iterates over the selected values.
    foreach(object toggleButtonValue in toggleButtonGroup1.SelectedValues) {
        // ...
    }
    

    Every time the selection changes, the button group fires the SelectedItemChanged event.

    HTML & CSS Template Customization

    The Toggle Button Group is created with HTML & CSS templates. This allows you to create fully custom layouts. Template customizations are handled with our HTML Template Editor that is integrated into the Visual Studio IDE. This tool uses an embedded Syntax Editor with autocomplete, tag navigation, and preview.