๐Ÿ”น Kt-RadioButton

Overview

KtRadioButton is a modern radio button control rendered as a styled button that provides mutually exclusive selections with rich visual customization. Combining the functionality of traditional radio buttons with the appearance of buttons, it offers gradient backgrounds, icons, and smooth state transitions for creating engaging user interfaces in Windows Forms applications.


Key Properties

Property
Type
Default
Description

Checked

bool

false

Gets or sets whether the radio button is selected

Text

string

""

The text displayed on the button

Icon

string

""

Icon identifier for unchecked state

Icon_Checked

string

"tabler.solid.circle_check_filled"

Icon identifier for checked state

Background

KtBrush

Solid

Background brush for unchecked state

Background_Checked

KtBrush

Solid

Background brush for checked state

Border

KtBrush

Gradient

Border brush for unchecked state

Border_Checked

KtBrush

Solid

Border brush for checked state

BorderRadius

float

10

Roundness of button corners

BorderWidth

float

2

Thickness of the border

BorderStyle

DashStyle

Solid

Border style for unchecked state

BorderStyle_Checked

DashStyle

Solid

Border style for checked state

Foreground

KtColor

Empty

Text/icon color for unchecked state

Foreground_Checked

KtColor

Empty

Text/icon color for checked state

IconColor

KtColor

Empty

Icon color for unchecked state

IconColor_Checked

KtColor

Empty

Icon color for checked state

IconSize

int

16

Size of the icon in pixels

IconStroke

double

2.5

Stroke width for icon rendering

TextAlign

ContentAlignment

MiddleCenter

Alignment of text within button

ImageAlign

ContentAlignment

MiddleLeft

Alignment of icon within button

TextMargin

int

0

Spacing between text and icon

Padding

Padding

7,7,7,7

Internal padding of button content


Events

Event
Description

CheckedChanged

Fires when the Checked property changes


Basic Usage

Simple Radio Button

Radio Button with Icon


Styling Examples

Gradient Background

Solid Color Style

Outline Style

Rounded Pill Style


Radio Button Groups

Creating Mutually Exclusive Groups

Radio buttons in the same container automatically form a mutually exclusive group:

Separate Groups with Panels


Common Patterns

Horizontal Button Group

Vertical Stack with Icons

Card-Style Selection

Tab-Style Navigation

Getting Selected Value

Using Tag Property


Advanced Features

Custom Icon Colors

Dynamic Border Styles

Programmatic Control

Text and Icon Alignment


Responsive Layouts

Auto-Adjust Based on Container

Grid Layout


Validation


Design Tips

  1. Consistent Sizing: Use uniform sizes within a button group for visual harmony

  2. Color Schemes: Use checked state colors that clearly indicate selection

  3. Icon Usage: Choose meaningful icons that represent the option

  4. Spacing: Maintain 10-15px spacing between buttons in horizontal layouts

  5. Border Radius: Match border radius with your application's design language

  6. Text Length: Keep button text concise for better readability

  7. Hover Feedback: The control automatically provides hover effects

  8. Default Selection: Pre-select the most common or recommended option


Performance Optimization


Accessibility Features

  • Automatic cursor change to hand pointer

  • Keyboard navigation support (Space/Enter keys)

  • Clear visual states for checked/unchecked

  • Focus state visualization

  • Mutually exclusive selection within groups

  • RTL (Right-to-Left) text support


Migration Notes

If migrating from standard RadioButton:

Last updated

Was this helpful?