Table of Contents

Class BoundValue

Namespace
PluginUI
Assembly
PluginUI.dll

One normalized value of a multi-value control (range slider, XY pad, envelope, multi-slider): either stored locally or bound to an IParameter, with the gesture protocol and change notification. Reusable by custom controls that edit several parameters at once.

public sealed class BoundValue
Inheritance
BoundValue
Inherited Members

Remarks

Call Attach() from OnAttached and Detach() from OnDetached so the binding follows the host lifetime (no leaked event subscriptions, no gesture left open).

Constructors

BoundValue(Action<BoundValue>, double, double)

Creates a value; changed is called after every change (user, code or parameter).

public BoundValue(Action<BoundValue> changed, double initial = 0, double defaultValue = 0)

Parameters

changed Action<BoundValue>
initial double
defaultValue double

Properties

DefaultValue

Default normalized value (parameter default when bound and not overridden).

public double DefaultValue { get; set; }

Property Value

double

Formatter

Optional formatter used by Format(double) (normalized → text).

[Browsable(false)]
public Func<double, string>? Formatter { get; set; }

Property Value

Func<double, string>

IsEditing

true during a gesture.

public bool IsEditing { get; }

Property Value

bool

Parameter

Bound parameter (null = local value).

public IParameter? Parameter { get; set; }

Property Value

IParameter

StepCount

Discrete steps (parameter's when bound).

public int StepCount { get; set; }

Property Value

int

Text

Text of the current value.

public string Text { get; }

Property Value

string

Value

Current normalized value.

public double Value { get; }

Property Value

double

Methods

Attach()

Subscribes to the parameter (call from the control's OnAttached).

public void Attach()

Begin()

Starts a gesture.

public void Begin()

Detach()

Ends any gesture and unsubscribes (call from the control's OnDetached).

public void Detach()

End()

Ends the gesture.

public void End()

Format(double)

Text of a normalized value (formatter, parameter text with units, or a percentage).

public string Format(double normalized)

Parameters

normalized double

Returns

string

Quantize(double)

Rounds to the step grid and clamps.

public double Quantize(double normalized)

Parameters

normalized double

Returns

double

Set(double)

Changes the value (inside a gesture: performEdit; outside: a complete single-step edit).

public void Set(double normalized)

Parameters

normalized double

SetByUser(double)

Complete single-step edit (reset, wheel, keyboard).

public void SetByUser(double normalized)

Parameters

normalized double