Table of Contents

Class Label

Namespace
PluginUI
Assembly
PluginUI.dll

Static or real-time text: single line (with ellipsis) or wrapped multi-line text, aligned in its bounds. Set TextSource to refresh the text on every frame (CPU load, voice count, tempo...).

public class Label : UIElement
Inheritance
Label
Inherited Members

Constructors

Label()

Creates an empty label.

public Label()

Label(string?)

Creates a label with a text.

public Label(string? text)

Parameters

text string

Properties

Background

Optional background fill.

public Color? Background { get; set; }

Property Value

Color?

CornerRadius

Corner radius of the background.

public float CornerRadius { get; set; }

Property Value

float

EffectiveTextStyle

Text style in effect.

protected TextStyle EffectiveTextStyle { get; }

Property Value

TextStyle

Foreground

Text color (null = theme text color, or dimmed text when IsDim).

public Color? Foreground { get; set; }

Property Value

Color?

IsDim

Uses the theme's secondary text color.

public bool IsDim { get; set; }

Property Value

bool

Padding

Inner spacing around the text.

public Thickness Padding { get; set; }

Property Value

Thickness

Text

Displayed text.

public string? Text { get; set; }

Property Value

string

TextAlignment

Horizontal text alignment (null = from the text style).

public HorizontalAlignment? TextAlignment { get; set; }

Property Value

HorizontalAlignment?

TextSource

Called on every frame while attached: its result replaces Text when it changes (real-time text). Null stops the refresh.

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

Property Value

Func<string>

TextStyle

Text style (null = theme normal text).

public TextStyle? TextStyle { get; set; }

Property Value

TextStyle

VerticalTextAlignment

Vertical text alignment (null = from the text style).

public VerticalAlignment? VerticalTextAlignment { get; set; }

Property Value

VerticalAlignment?

Wrap

Wraps on word boundaries (multi-line).

public bool Wrap { get; set; }

Property Value

bool

Methods

MeasureOverride(Size)

Natural size of the content for the available size (margins excluded).

protected override Size MeasureOverride(Size available)

Parameters

available Size

Returns

Size

OnAttached()

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

protected override void OnAttached()

OnDetached()

Called when the element leaves its host (unsubscribe here).

protected override void OnDetached()

OnRender(DrawingContext)

Draws the element (below its children).

protected override void OnRender(DrawingContext dc)

Parameters

dc DrawingContext