标签扩展

Label 扩展提供了一系列支持配置 Label 的扩展方法。

FormattedText

通过 FormattedText 方法,可向 Label.FormattedTextProperty 分配多个 Span

下面的示例说明如何使用 .FormattedText()Label 中添加多个 Span

new Label().FormattedText(new[] 
{
    new Span { Text = "Here is a link to the docs: " },
    new Span { Text = "https://learn.microsoft.com/", TextDecorations = TextDecorations.Underline, TextColor = Colors.Blue }
});