Skip to content

* Expand KryptonCheckBox to allow more text#3835

Open
PWagner1 wants to merge 1 commit into
alphafrom
3833-feature-request-expand-kryptoncheckbox-to-allow-more-text
Open

* Expand KryptonCheckBox to allow more text#3835
PWagner1 wants to merge 1 commit into
alphafrom
3833-feature-request-expand-kryptoncheckbox-to-allow-more-text

Conversation

@PWagner1

@PWagner1 PWagner1 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

PR: KryptonCheckBoxExtended — word-wrapped checkbox with subtext (#3833)

Closes #3833

Summary

Adds KryptonCheckBoxExtended to Krypton.Toolkit.Utilities: a checkbox control with Krypton styling that supports word-wrapped main text, optional secondary subtext, configurable spacing, optional clickable subtext links, and accessibility support. The base KryptonCheckBox is unchanged.

This follows the same placement pattern as other extended controls (for example KryptonCommandLinkButton) and is modelled after the word-wrap / subtext behaviour of dahall/groupcontrols CheckBoxEx.

What's included

New control: KryptonCheckBoxExtended

  • Word-wrapped main text (no ellipsis truncation at typical widths)
  • Optional subtext below the main text with separate font and colour
  • Top-aligned checkbox glyph (multi-line friendly)
  • Full parity with KryptonCheckBox for checked state, three-state, KryptonCommand, orientation, check position, palette overrides, and image values
  • Palette content padding for spacing between glyph and text (plus optional extra TextGap)

Expandable designer property groups

Property Contents
Values Main text, subtext, subtext font/colour, images

Top-level Text and Subtext remain available for binding; layout and link settings are also forward-compatible via hidden designer-hidden properties.

Subtext links

  • Set SubtextLinkValues.LinkArea to define a character range as a link
  • Handle SubtextLinkClicked without toggling the checkbox
  • Clicks on non-link subtext still toggle the checkbox
  • Hand cursor over link regions

Accessibility

  • Custom accessible object: main text as name, subtext as description, check state and default action exposed to screen readers

TestForm demo

  • CheckBoxExtendedDemo — agreement-style checkbox with wrapped text, subtext, linked phrase ("full agreement"), and comparison with a standard KryptonCheckBox at the same width
  • Entry points: Start Screen → "CheckBox Extended", and Main → "CheckBox Extended"

Implementation notes

  • ViewDrawCheckBoxExtendedContent — custom view drawer; standard ViewDrawContent ellipsizes single-line text, so word wrap uses TextRenderer with WordBreak for measure and paint
  • SubtextLinkPresenter — internal KryptonLinkWrapLabel overlay for link hit-testing and rendering when LinkArea is set
  • ViewLayoutSeparator — implements configurable TextGap between glyph column and text
  • Projects auto-include new .cs files under Krypton.Toolkit.Utilities; no project file changes required

Files changed

New

  • Source/Krypton Components/Krypton.Toolkit.Utilities/Components/KryptonCheckBoxExtended/ (control, values, view, designers, accessibility, link presenter)
  • Source/Krypton Components/TestForm/CheckBoxExtendedDemo.cs
  • Source/Krypton Components/TestForm/CheckBoxExtendedDemo.Designer.cs

Modified

Test plan

  • Build Krypton.Toolkit.Utilities and TestForm (Debug, at least one .NET Framework TFM e.g. net48)
  • Run TestFormCheckBox Extended
  • Confirm main text wraps when the form is narrowed; subtext remains visible below
  • Confirm spacing between checkbox glyph and text matches standard KryptonCheckBox (palette padding + optional TextGap)
  • Adjust LayoutValues.SubtextSeparatorHeight and confirm gap between main text and subtext changes
  • Click "full agreement" link — status updates; checkbox does not toggle
  • Click subtext outside the link — checkbox toggles
  • Click main text / checkbox — checkbox toggles
  • Toggle checked, disabled, and focus states; try another palette/theme
  • Verify control appears in the toolbox under Krypton.Toolkit.Utilities (designer)

Breaking changes

None. This is a new control in Utilities; existing KryptonCheckBox consumers are unaffected.

NuGet / deployment note

Consumers need the Krypton.Standard.Toolkit (or equivalent) package that includes Krypton.Toolkit.Utilities, as documented in the changelog entry.

image

# PR: `KryptonCheckBoxExtended` — word-wrapped checkbox with subtext (#3833)

Closes [#3833](#3833)

## Summary

Adds **`KryptonCheckBoxExtended`** to **`Krypton.Toolkit.Utilities`**: a checkbox control with Krypton styling that supports word-wrapped main text, optional secondary subtext, configurable spacing, optional clickable subtext links, and accessibility support. The base **`KryptonCheckBox`** is unchanged.

This follows the same placement pattern as other extended controls (for example `KryptonCommandLinkButton`) and is modelled after the word-wrap / subtext behaviour of [dahall/groupcontrols `CheckBoxEx`](https://github.com/dahall/groupcontrols/blob/master/GroupControls/CheckBoxEx.cs).

## What's included

### New control: `KryptonCheckBoxExtended`

- Word-wrapped main text (no ellipsis truncation at typical widths)
- Optional subtext below the main text with separate font and colour
- Top-aligned checkbox glyph (multi-line friendly)
- Full parity with `KryptonCheckBox` for checked state, three-state, `KryptonCommand`, orientation, check position, palette overrides, and image values
- Palette content padding for spacing between glyph and text (plus optional extra `TextGap`)

### Expandable designer property groups

| Property | Contents |
|----------|----------|
| **`Values`** | Main text, subtext, subtext font/colour, images |
| **`LayoutValues`** | `SubtextSeparatorHeight` (gap between text and subtext, default 5px), `TextGap` (extra glyph-to-text spacing) |
| **`SubtextLinkValues`** | `LinkArea`, `LinkColor` for clickable subtext regions |

Top-level **`Text`** and **`Subtext`** remain available for binding; layout and link settings are also forward-compatible via hidden designer-hidden properties.

### Subtext links

- Set `SubtextLinkValues.LinkArea` to define a character range as a link
- Handle **`SubtextLinkClicked`** without toggling the checkbox
- Clicks on non-link subtext still toggle the checkbox
- Hand cursor over link regions

### Accessibility

- Custom accessible object: main text as name, subtext as description, check state and default action exposed to screen readers

### TestForm demo

- **`CheckBoxExtendedDemo`** — agreement-style checkbox with wrapped text, subtext, linked phrase ("full agreement"), and comparison with a standard `KryptonCheckBox` at the same width
- Entry points: **Start Screen** → "CheckBox Extended", and **Main** → "CheckBox Extended"

## Implementation notes

- **`ViewDrawCheckBoxExtendedContent`** — custom view drawer; standard `ViewDrawContent` ellipsizes single-line text, so word wrap uses `TextRenderer` with `WordBreak` for measure and paint
- **`SubtextLinkPresenter`** — internal `KryptonLinkWrapLabel` overlay for link hit-testing and rendering when `LinkArea` is set
- **`ViewLayoutSeparator`** — implements configurable `TextGap` between glyph column and text
- Projects auto-include new `.cs` files under `Krypton.Toolkit.Utilities`; no project file changes required

## Files changed

**New**

- `Source/Krypton Components/Krypton.Toolkit.Utilities/Components/KryptonCheckBoxExtended/` (control, values, view, designers, accessibility, link presenter)
- `Source/Krypton Components/TestForm/CheckBoxExtendedDemo.cs`
- `Source/Krypton Components/TestForm/CheckBoxExtendedDemo.Designer.cs`

**Modified**

- `Documents/Changelog/Changelog.md` — V110 entry for #3833
- `Source/Krypton Components/TestForm/Main.cs` / `Main.Designer.cs` — demo button
- `Source/Krypton Components/TestForm/StartScreen.cs` — start screen entry

## Test plan

- [ ] Build `Krypton.Toolkit.Utilities` and `TestForm` (Debug, at least one .NET Framework TFM e.g. `net48`)
- [ ] Run **TestForm** → **CheckBox Extended**
- [ ] Confirm main text wraps when the form is narrowed; subtext remains visible below
- [ ] Confirm spacing between checkbox glyph and text matches standard `KryptonCheckBox` (palette padding + optional `TextGap`)
- [ ] Adjust **`LayoutValues.SubtextSeparatorHeight`** and confirm gap between main text and subtext changes
- [ ] Click **"full agreement"** link — status updates; checkbox does not toggle
- [ ] Click subtext outside the link — checkbox toggles
- [ ] Click main text / checkbox — checkbox toggles
- [ ] Toggle checked, disabled, and focus states; try another palette/theme
- [ ] Verify control appears in the toolbox under `Krypton.Toolkit.Utilities` (designer)

## Breaking changes

None. This is a new control in **Utilities**; existing `KryptonCheckBox` consumers are unaffected.

## NuGet / deployment note

Consumers need the **`Krypton.Standard.Toolkit`** (or equivalent) package that includes **`Krypton.Toolkit.Utilities`**, as documented in the changelog entry.
@PWagner1 PWagner1 added this to the Version 110 milestone Jul 3, 2026
@PWagner1 PWagner1 requested a review from a team as a code owner July 3, 2026 07:57
@PWagner1 PWagner1 added version:110 All things to do with V110. area:toolkit-utilities All issues relating to `Krypton.Utilities`. labels Jul 3, 2026
@PWagner1 PWagner1 linked an issue Jul 3, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:toolkit-utilities All issues relating to `Krypton.Utilities`. version:110 All things to do with V110.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Expand KryptonCheckBox to allow more text

1 participant