Label
This page descibes how to create a Label in MauiReactor
Label("My label text")Label(
FormattedString(
Span("Red bold, ", Colors.Red, FontAttributes.Bold),
Span("default, ",
TapGestureRecognizer(async () => await ContainerPage!.DisplayAlert("Tapped", "This is a tapped Span.", "OK"))
),
Span("italic small.", FontAttributes.Italic, 14)
)
)Label()
.FormattedText(()=>
{
//of course FomattedText here, being static, can be created as a static variable and passed to Label().FormattedText(myStaticFormattedText)
FormattedString formattedString = new();
formattedString.Spans.Add(new Span { Text = "Red bold, ", TextColor = Colors.Red, FontAttributes = FontAttributes.Bold });
Span span = new() { Text = "default, " };
span.GestureRecognizers.Add(new MauiControls.TapGestureRecognizer { Command = new Command(async () => await ContainerPage!.DisplayAlert("Tapped", "This is a tapped Span.", "OK")) });
formattedString.Spans.Add(span);
formattedString.Spans.Add(new Span { Text = "italic small.", FontAttributes = FontAttributes.Italic, FontSize = 14 });
return formattedString;
})
Last updated