Span

A styled run of text inside a Label's or TextView's spans.

Every unset visual property follows the containing control; a set one overrides it for this run alone.

public class Span

Constructors

Creates a span.

public Span(
  string text)
ParameterSummary
string textThe run's text.

Properties

Bold

Shorthand for a bold FontWeight.

Type: bool

public bool Bold { get; set; }

FontDesign

The run's font design, or null to follow the containing control.

Type: FontDesign?

public FontDesign? FontDesign { get; set; }

FontSize

The run's base font size in points, scaled by Dynamic Type, or NaN to follow its text style or the containing control.

Type: double

public double FontSize { get; set; }

FontWeight

The run's font weight, or null to follow the containing control.

Type: FontWeight?

public FontWeight? FontWeight { get; set; }

MaxFontSize

The largest point size Dynamic Type may produce, or NaN to follow the containing control.

Set this and MinFontSize to the same value for a fixed-size run.

Type: double

public double MaxFontSize { get; set; }

MinFontSize

The smallest point size Dynamic Type may produce, or NaN to follow the containing control.

Type: double

public double MinFontSize { get; set; }

Strikethrough

Strikes the run through.

Type: bool

public bool Strikethrough { get; set; }

Text

The run's text.

Type: string

public string Text { get; set; }

TextAlignment

The alignment of the run's paragraph, or null to follow the containing control.

Paragraph alignment applies to the complete paragraph. Use this override on a span that covers the whole paragraph, including its terminating newline when one follows.

Type: TextAlignment?

public TextAlignment? TextAlignment { get; set; }

TextColor

The run's text color, or null to follow the containing control.

Type: Color?

public Color? TextColor { get; set; }

TextStyle

The run's Dynamic Type text style, or null to follow the containing control.

An explicit FontSize takes precedence over this style.

Type: TextStyle?

public TextStyle? TextStyle { get; set; }

Underline

Underlines the run.

Type: bool

public bool Underline { get; set; }

Operators

Implicit Span(string)

Wraps a plain string as an unstyled span, so string literals sit beside styled runs in a list.

public static implicit operator Span(
  string text)
ParameterSummary
string textThe run's text.

Returns

  • Span: An unstyled span containing the text.