๐Ÿ”น Kt-CheckBox

Overview

KtCheckBox is a highly customizable checkbox control that provides enhanced visual support for on/off states with smooth animations, multiple styles, and label binding capabilities. Inspired by modern checkbox designs, it offers rich state management and flexible styling options for Windows Forms applications.


Key Properties

Property
Type
Default
Description

Checked

bool

true

Gets or sets whether the checkbox is checked

CheckState

CheckStates

Checked

Gets or sets the check state (Checked, Unchecked, Indeterminate)

ThreeState

bool

false

Enables three-state mode (Checked, Unchecked, Indeterminate)

Style

CheckBoxStyles

Tailwind

Visual style: Tailwind, Flat, or Round

ColorScheme

KtColor

PRIMARY

Color scheme for the checkbox

Label

Label

null

Label control to bind with the checkbox

LabelPosition

BindingControlPositions

Right

Position of bound label (Left or Right)

AutoCheck

bool

true

Automatically toggles state on click

AnimateCheckBox

bool

false

Enables checkbox animation on state change

AnimateCheckMark

bool

true

Enables checkmark animation on state change

BorderRadius

int

12

Corner radius of the checkbox (1-20)

ToolTip

string

""

Tooltip text displayed on hover

AllowBindingControlLocation

bool

true

Auto-positions bound label relative to checkbox

AllowBindingControlColorChanges

bool

true

Colorizes bound label on hover

AllowOnHoverStates

bool

true

Enables hover state styling


State Properties

Each checkbox has multiple state objects that define its appearance:

State
Description

OnCheck

Appearance when checked

OnUncheck

Appearance when unchecked

OnHoverChecked

Appearance when hovered and checked

OnHoverUnchecked

Appearance when hovered and unchecked

OnDisable

Appearance when disabled

State Properties

Each state object has these properties:

Property
Type
Description

CheckBoxColor

KtColor

Inner fill color

BorderColor

KtColor

Border color

CheckmarkColor

KtColor

Checkmark color

BorderRadius

int

Corner radius (1-20)

BorderThickness

int

Border thickness

CheckmarkThickness

int

Checkmark line thickness


Events

Event
Arguments
Description

CheckedChanged

CheckedChangedEventArgs

Fires when Checked property changes

CheckStateChanged

CheckedChangedEventArgs

Fires when CheckState changes

StatePropertiesChanged

StatePropertiesChangedEventArgs

Fires when state properties are modified

StylePropertyChanged

StylePropertyChangedEventArgs

Fires when Style property changes

BindingControlChanged

BindingControlChangedEventArgs

Fires when bound label changes

BindingControlPositionChanged

PositionChangedEventArgs

Fires when label position changes


Basic Usage

Simple Checkbox

Checkbox with Label

Checkbox with Location


Styling Examples

Custom Color Scheme

Round Style

Custom Border Radius

Flat Style


Advanced Features

Three-State Checkbox

Custom State Styling

Animations

Programmatic Label Binding


Label Management

Creating Labels Programmatically

Label Positioning

Disabling Label Color Changes


Common Patterns

Checkbox List

Select All Pattern

Settings Panel

Form Validation


Tooltip Usage


Keyboard Support

The checkbox supports keyboard interaction:


State Access in Events


Design Tips

  1. Size Consistency: Standard size is 21x21, but can be customized. Height automatically adjusts to width

  2. Label Spacing: The control automatically manages spacing between checkbox and label

  3. Color Scheme: Use consistent color schemes across your application

  4. Animations: Enable animations for a more polished user experience

  5. Three-State: Use for parent-child checkbox relationships (e.g., "Select All")

  6. Hover States: Keep AllowOnHoverStates enabled for better user feedback


Performance Optimization


Accessibility Features

  • Automatic cursor change to hand pointer

  • Accessible role set to CheckButton for bound labels

  • Keyboard navigation support (Space key to toggle)

  • Clear visual states for checked/unchecked/hover

  • Tooltip support for additional context


Enumerations

CheckBoxStyles

CheckStates

BindingControlPositions


Migration Notes

If migrating from standard CheckBox:

Last updated

Was this helpful?