Skip to main content

CheckBox Class

NuGet: GHIElectronics.TinyCLR.UI
Assembly: GHIElectronics.TinyCLR.UI
Namespace: GHIElectronics.TinyCLR.UI.Controls

A two-state check box that toggles when clicked.

public class CheckBox : ContentControl, IDisposable

Constructors

CheckBox()

public CheckBox() : base()

Creates a new CheckBox.

Properties

Name

public string Name { get; set; }

Optional name identifying the check box.

Alpha

public ushort Alpha { get; set; }

Opacity (0-255) used when drawing the check box image.

RadiusBorder

public ushort RadiusBorder { get; set; }

Corner radius used by the nine-slice check box image.

ClickMode

public ClickMode ClickMode { get; set; }

Determines whether the check box clicks/toggles on touch press or release. Default is ClickMode.Release (WPF convention); set to ClickMode.Press for the instant TinyCLR 2.x response.

IsChecked

public bool IsChecked { get; set; }

Whether the check box is currently checked.

Methods

OnRender(DrawingContext dc)

public override void OnRender(DrawingContext dc)

Draws the check box in its checked or unchecked state.

OnTouchUp(TouchEventArgs e)

protected override void OnTouchUp(TouchEventArgs e)

Handles touch release; toggles the check box (unless it already toggled on press).

OnTouchDown(TouchEventArgs e)

protected override void OnTouchDown(TouchEventArgs e)

Handles touch press. In the default Release mode toggling is deferred to touch release; in ClickMode.Press mode it toggles immediately.

OnButtonUp(ButtonEventArgs e)

protected override void OnButtonUp(ButtonEventArgs e)

Handles the Select hardware button release; toggles the check box.

Dispose()

public void Dispose()

Releases the resources used by the check box.

Dispose(bool disposing)

protected virtual void Dispose(bool disposing)

Releases the check box's bitmap resources.

Events

Click

public event RoutedEventHandler Click

Raised when the check box is clicked.

Checked

public event RoutedEventHandler Checked

Raised when the check box becomes checked.

Unchecked

public event RoutedEventHandler Unchecked

Raised when the check box becomes unchecked.