Table of Contents

Class ToggleButton

Namespace
PluginUI
Assembly
PluginUI.dll

On/off button (bypass, enable, mode toggles). Toggles on press; the "on" state is drawn with the accent color, or with a glowing LED when ShowLed is set. Text can differ between states.

public class ToggleButton : ValueControl
Inheritance
ToggleButton
Inherited Members

Constructors

ToggleButton()

Creates a toggle button.

public ToggleButton()

ToggleButton(string)

Creates a toggle button with a caption.

public ToggleButton(string text)

Parameters

text string

Properties

CurrentText

Caption for the current state.

protected string? CurrentText { get; }

Property Value

string

DefaultSize

Natural size used when no explicit size is given.

protected override Size DefaultSize { get; }

Property Value

Size

IsOn

true in the on state.

public bool IsOn { get; set; }

Property Value

bool

OffText

Caption in the off state.

public string? OffText { get; set; }

Property Value

string

OnColor

LED / on color (null = style accent).

public Color? OnColor { get; set; }

Property Value

Color?

OnText

Caption in the on state.

public string? OnText { get; set; }

Property Value

string

ShowLed

Draws an LED left of the caption instead of filling the button with the accent color.

public bool ShowLed { get; set; }

Property Value

bool

Text

Caption used for both states when OnText/OffText are not set.

public string? Text { get; set; }

Property Value

string

TextStyle

Text style (null = theme normal text, centered).

public TextStyle? TextStyle { get; set; }

Property Value

TextStyle

ValueText

Text drawn in the value area (null = no value area).

public override string? ValueText { get; }

Property Value

string

Methods

OnKeyDown(KeyEventArgs)

Key pressed while focused (bubbles to parents).

protected override void OnKeyDown(KeyEventArgs e)

Parameters

e KeyEventArgs

OnMouseDown(MouseEventArgs)

Mouse button pressed over the element (or captured).

protected override void OnMouseDown(MouseEventArgs e)

Parameters

e MouseEventArgs

OnMouseUp(MouseEventArgs)

Mouse button released.

protected override void OnMouseUp(MouseEventArgs e)

Parameters

e MouseEventArgs

RenderVector(DrawingContext, Rect, VectorStyle)

Vector rendering of the widget area.

protected override void RenderVector(DrawingContext dc, Rect widget, VectorStyle style)

Parameters

dc DrawingContext
widget Rect
style VectorStyle