Table of Contents

Class SlideSwitch

Namespace
PluginUI
Assembly
PluginUI.dll

Toggle switch: a pill with a sliding knob (animated), with an optional caption on the right (or OnText/OffText state captions).

public class SlideSwitch : ValueControl
Inheritance
SlideSwitch
Inherited Members

Constructors

SlideSwitch()

Creates a slide switch.

public SlideSwitch()

SlideSwitch(string, bool)

Creates a slide switch with a caption.

public SlideSwitch(string text, bool isOn = false)

Parameters

text string
isOn bool

Properties

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 (replaces Text).

public string? OffText { get; set; }

Property Value

string

OnText

Caption in the on state (replaces Text).

public string? OnText { get; set; }

Property Value

string

Text

Caption drawn right of the switch.

public string? Text { get; set; }

Property Value

string

TrackHeight

Height of the pill in DIPs.

public float TrackHeight { get; set; }

Property Value

float

ValueText

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

public override string? ValueText { get; }

Property Value

string

Methods

OnAttached()

Called when the element joins a host (subscribe to external events here).

protected override void OnAttached()

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

OnValueChanged()

Called after every value change; raises ValueChanged and repaints.

protected override void OnValueChanged()

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