* Expand KryptonCheckBox to allow more text#3835
Open
PWagner1 wants to merge 1 commit into
Open
Conversation
# 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR:
KryptonCheckBoxExtended— word-wrapped checkbox with subtext (#3833)Closes #3833
Summary
Adds
KryptonCheckBoxExtendedtoKrypton.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 baseKryptonCheckBoxis 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/groupcontrolsCheckBoxEx.What's included
New control:
KryptonCheckBoxExtendedKryptonCheckBoxfor checked state, three-state,KryptonCommand, orientation, check position, palette overrides, and image valuesTextGap)Expandable designer property groups
ValuesTop-level
TextandSubtextremain available for binding; layout and link settings are also forward-compatible via hidden designer-hidden properties.Subtext links
SubtextLinkValues.LinkAreato define a character range as a linkSubtextLinkClickedwithout toggling the checkboxAccessibility
TestForm demo
CheckBoxExtendedDemo— agreement-style checkbox with wrapped text, subtext, linked phrase ("full agreement"), and comparison with a standardKryptonCheckBoxat the same widthImplementation notes
ViewDrawCheckBoxExtendedContent— custom view drawer; standardViewDrawContentellipsizes single-line text, so word wrap usesTextRendererwithWordBreakfor measure and paintSubtextLinkPresenter— internalKryptonLinkWrapLabeloverlay for link hit-testing and rendering whenLinkAreais setViewLayoutSeparator— implements configurableTextGapbetween glyph column and text.csfiles underKrypton.Toolkit.Utilities; no project file changes requiredFiles changed
New
Source/Krypton Components/Krypton.Toolkit.Utilities/Components/KryptonCheckBoxExtended/(control, values, view, designers, accessibility, link presenter)Source/Krypton Components/TestForm/CheckBoxExtendedDemo.csSource/Krypton Components/TestForm/CheckBoxExtendedDemo.Designer.csModified
Documents/Changelog/Changelog.md— V110 entry for [Feature Request]: ExpandKryptonCheckBoxto allow more text #3833Source/Krypton Components/TestForm/Main.cs/Main.Designer.cs— demo buttonSource/Krypton Components/TestForm/StartScreen.cs— start screen entryTest plan
Krypton.Toolkit.UtilitiesandTestForm(Debug, at least one .NET Framework TFM e.g.net48)KryptonCheckBox(palette padding + optionalTextGap)LayoutValues.SubtextSeparatorHeightand confirm gap between main text and subtext changesKrypton.Toolkit.Utilities(designer)Breaking changes
None. This is a new control in Utilities; existing
KryptonCheckBoxconsumers are unaffected.NuGet / deployment note
Consumers need the
Krypton.Standard.Toolkit(or equivalent) package that includesKrypton.Toolkit.Utilities, as documented in the changelog entry.