Skip to main content

RadioButton Class

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

A selectable button that is mutually exclusive with other buttons sharing its group name.

public class RadioButton : ContentControl, IDisposable

Constructors​

RadioButton()​

public RadioButton() : this(string.Empty)

Initializes a new radio button with no group name.

RadioButton(string groupName)​

public RadioButton(string groupName) : base()

Initializes a new radio button belonging to the given group.

Properties​

Name​

public string Name { get; set; }

The identifying name of this button within its group.

Alpha​

public ushort Alpha { get; set; }

The opacity applied when rendering the button.

RadiusBorder​

public int RadiusBorder { get; set; }

Corner radius in pixels for the Scale9-rendered background.

ShowBackground​

public bool ShowBackground { get; set; }

Whether the bitmap background is drawn behind the button.

ClickMode​

public ClickMode ClickMode { get; set; }

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

Value​

public string Value { get; set; }

The button's value when checked, or an empty string when unchecked.

Checked​

public bool Checked { get; set; }

Whether the button is currently selected.

GroupName​

public string GroupName { get; set; }

The name of the group this button belongs to.

OutlineUnselectColor​

public GHIElectronics.TinyCLR.UI.Media.Color OutlineUnselectColor { get; set; }

The outline color of the indicator when the button is unchecked.

SelectedOutlineColor​

public GHIElectronics.TinyCLR.UI.Media.Color SelectedOutlineColor { get; set; }

The outline color of the indicator when the button is checked.

SelectedColor​

public GHIElectronics.TinyCLR.UI.Media.Color SelectedColor { get; set; }

The fill color of the indicator when the button is checked.

Methods​

OnRender(DrawingContext dc)​

public override void OnRender(DrawingContext dc)

Renders the radio button background and its checked/unchecked indicator.

OnTouchUp(TouchEventArgs e)​

protected override void OnTouchUp(TouchEventArgs e)

Handles a touch release by clicking and selecting the button (unless it already fired on press).

OnTouchDown(TouchEventArgs e)​

protected override void OnTouchDown(TouchEventArgs e)

Handles a touch press. In the default Release mode the click is performed on release; in ClickMode.Press mode it fires immediately.

OnButtonUp(ButtonEventArgs e)​

protected override void OnButtonUp(ButtonEventArgs e)

Handles the Select hardware button by clicking and toggling the button.

Toggle()​

public void Toggle()

Toggles the checked state, unselecting any other button in the group.

Dispose()​

public void Dispose()

Releases the bitmap resources used by the radio button.

Dispose(bool disposing)​

protected virtual void Dispose(bool disposing)

Releases the bitmap resources used by the radio button.

Events​

Click​

public event RoutedEventHandler Click

Raised when the button is clicked.