CheckBoxGroup - ahatornn/clforms GitHub Wiki
ClForms.Elements.CheckBoxGroup
A group of related but mutually exclusive checkbox buttons
public class CheckBoxGroup: GroupItemControl, IElementStyle<CheckBoxGroup>Inheritance Control -> BaseFocusableControl -> GroupItemControl -> CheckBoxGroup
Derived IElementStyle<CheckBoxGroup>
The following code example creates a CheckBoxGroup, sets its Text property to "CheckBoxGroup panel" AutoSize to false, Columns to 3, and adds event handler OnSelectedCheckedChanged. Also adds items for checking.
var cbg1 = new CheckBoxGroup()
{
Text = "CheckBoxGroup panel",
AutoSize = false,
Columns = 3,
};
cbg1.OnSelectedCheckedChanged += SelectedCheckedHandler;
cbg1.Items.Add("January");
cbg1.Items.Add("February");
cbg1.Items.Add("March");
cbg1.Items.Add("April", isDisabled: true);
panel1.AddContent(cbg1);
…
private void SelectedCheckedHandler(object sender, SelectedItemCheckedEventArgs e)
{
// put your business logic here
}You can find more examples of using the CheckBoxGroup in this project
An item can be clicked by using ENTER key, or SPACEBAR if the CheckBoxGroup has focus.
The Background and Foreground properties as default equals Color.NotSet value (transparent).
| Syntax | Description |
|---|---|
| CheckBoxGroup() | Initialize a new CheckBoxGroup instance |
| Name | Type | Description |
|---|---|---|
| AutoSize | bool | Gets or sets a value indicating whether the control is resized in accordance with its contents |
| Background | Color | Gets or sets a brush that describes the background of a control |
| BackgroundIsTransparent | bool | Gets a value indicating whether the Background has Color.NotSet
|
| BorderChars | BorderChars | Gets or sets the BorderChars that draws the border characters |
| BorderColor | Color | Gets or sets the Color that draws the border color |
| BorderThickness | Thickness | Gets or sets the relative frame Thickness of a GroupItemControl |
| Bounds | Rect | Gets the size and location of the control including its nonclient elements, in points, relative to the parent control |
| Columns | int | Gets or sets the number of columns in the switch group |
| DesiredSize | Size | Gets the size that this element computed during the measure pass of the layout process |
| DisabledBackground | Color | Gets or sets a value to display of background when the control is disabled |
| DisabledForeground | Color | Gets or sets a value to display of text color when the control is disabled |
| DrawingContext | IDrawingContext | Gets a value of the drawing context |
| FocusBackground | Color | Focused component background color |
| FocusForeground | Color | Focused component text color |
| Foreground | Color | Gets or sets a brush that describes the text of a control |
| ForegroundIsTransparent | bool | Gets a value indicating whether the Foreground has Color.NotSet
|
| Height | int? | Gets or sets the height of the control |
| Id | long | Gets a value of the control's identifier |
| IsDisabled | bool | Gets or sets a value indicating whether the control cannot respond to user interaction |
| IsFocus | bool | Gets or sets focus value of component |
| IsMeasureValid | bool | Gets a value indicating whether component sizing was performed |
| IsVisualValid | bool | Gets a value indicating whether the component is being re-rendered |
| Items | GroupItemCollection | Gets all elements in GroupItemControl |
| Location | Point | Gets or sets the coordinates of the upper-left corner of the control relative to the upper-left corner of its container |
| Margin | Thickness | Gets or sets the outer margin of an element |
| Padding | Thickness | Gets or sets a Thickness value that describes the amount of space between a control and its child element |
| Parent | ContentControl | Gets or sets the parent container of the control |
| SelectedIndexes | IEnumerable<int> | Gets or sets the zero-based index of the all selected items in a CheckBoxGroup |
| TabIndex | int | Gets or sets the sequence for moving the TAB key between the controls inside the container |
| TabStop | bool | Gets or sets a value indicating whether the user can focus on the given control using the TAB key |
| Tag | object | Gets or sets the object that contains data about the control |
| Text | string | Gets or sets the text associated with this control |
| TextAlignment | TextAlignment | Gets or sets the horizontal alignment of the text associated with this control |
| this[int index] | CheckState | Gets or sets the CheckState of specified item by index |
| Width | int? | Gets or sets the width of the control |
| Syntax | Description |
|---|---|
| Arrange(Rect) | Positions child elements and determines a size for a Control. Parent elements call this method from their Arrange(Rect) implementation to form a recursive layout update |
| CanFocus() | Indicates whether component focus can be set |
| CheckAll() | Checks all the items in the CheckBoxGroup |
| InputAction(ConsoleKeyInfo) | Handles a keystroke |
| InvalidateMeasure() | Invalidates the measurement state (layout) for the element |
| InvalidateMeasureIfAutoSize() | Invalidates the measurement state (layout) for the element if AutoSize property is true otherwise invalidates the rendering of the element |
| InvalidateVisual() | Invalidates the rendering of the element, and forces a complete new layout pass. OnRender(IDrawingContext) is called after the layout cycle is completed |
| Measure(Size) | Updates DesiredSize of a Control. Parent elements call this method from their own Measure(Size) implementations to form a recursive layout update |
| OnRender(IDrawingContext) | Filling a pseudographics drawing context |
| ParentWindow() | Gets the form the control is in |
| SetFocus() | Sets input focus to current item |
| SetStyle(Action) | Defines actions with an element style |
| UncheckAll() | Uncheck all the items in the CheckBoxGroup |
| Event | Description |
|---|---|
| OnAutoSizeChanged | Occurs when the value of the AutoSize property changes |
| OnBackgroundChanged | Occurs when the value of the Background property changes |
| OnDisabledBackgroundChanged | Occurs when the value of the DisabledBackground property changes |
| OnDisabledChanged | Occurs when the value of the IsDisabled property changes |
| OnDisabledForegroundChanged | Occurs when the value of the DisabledForeground property changes |
| OnBorderCharsChanged | Occurs when the value of the BorderChars property changes |
| OnBorderColorChanged | Occurs when the value of the BorderColor property changes |
| OnBorderThicknessChanged | Occurs when the value of the BorderThickness property changes |
| OnColumnsChanged | Occurs when the value of the Columns property changes |
| OnEnter | Input focus event |
| OnFocusBackgroundChanged | Occurs when the value of the FocusBackground property changes |
| OnFocusChanged | Occurs when the value of the IsFocus property changes |
| OnFocusForegroundChanged | Occurs when the value of the FocusForeground property changes |
| OnForegroundChanged | Occurs when the value of the Foreground property changes |
| OnHeightChanged | Occurs when the value of the Height property changes |
| OnLeave | Input focus loss event |
| OnMarginChanged | Occurs when the value of the Margin property changes |
| OnPaddingChanged | Occurs when the value of the Padding property changes |
| OnParentChanged | Occurs when the value of the Parent property changes |
| OnSelectedCheckedChanged | Occurs when the selected item changes state |
| OnTabIndexChanged | Occurs when a property value of TabIndex changes |
| OnTabStopChanged | Occurs when a property value of TabStop changes |
| OnTagChanged | Occurs when the value of the Tag property changes |
| OnTextAlignmentChanged | Occurs when the value of the TextAlignment property changes |
| OnTextChanged | Occurs when the value of the Text property changes |
| OnWidthChanged | Occurs when the value of the Width property changes |