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

    • 2 minutes to read

    The Toggle Button (ToggleButton) is a button used to select one of two mutually exclusive options/values.

    Toggle Button - WinForms UI Templates

    Button State

    The Checked property specifies the button’s state. When its value changes, the Toggle Button fires the CheckedChanged event.

    Button Text

    Use the CheckedText and UncheckedText properties to specify the button’s text for checked and unchecked states respectively. By default, these properties are set to ON and OFF respectively.

    The text can be displayed outside or inside the toggle button. Use the TextPosition property to specify this setting.

    Value Description Screenshot
    Outside Displays the text outside the toggle button. Toggle Button Text Position Outside - WinForms UI Templates, DevExpress
    Inside Displays the text inside the toggle button. Toggle Button Text Position Inside - WinForms UI Templates, DevExpress
    None Hides the text. Toggle Button Text Hidden Inside - WinForms UI Templates, DevExpress
    using DevExpress.UITemplates.Collection.Editors.ToggleButton;
    
    // Displays the text inside the toggle button.
    toggleButton1.TextPosition = Position.Inside;
    

    Toggle Button Size

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

    Value 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

    Switch Thumb Customization

    Use IconImageOptions property to specify a custom image as a switch thumb. You can choose an image from the DevExpress Image Gallery, which is packed with thousands of high-quality SVG and PNG icons, or you can specify your own graphics.

    HTML & CSS Template Customization

    Toggle Buttons are created with HTML & CSS templates. This allows you to create fully custom buttons. 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.

    See Also