Reputation: 1
How can I achieve such an effect with an Label in maui. It looks somehow like selected text and I couldn't find something similar in the API.
background label text in .net maui
This is not a background color for the view, but a background color only for the text. You can see how it stops at line breaks and has a thin white line between text lines.
Upvotes: 0
Views: 1258
Reputation: 4332
As FreakyAli said that you can use TextDecorations
to close to that effect (have a thin white line between text lines) :
<Label>
<Label.FormattedText>
<FormattedString >
<Span TextColor="White"
BackgroundColor="SkyBlue"
TextDecorations="Underline"
Text="A Span can also respond to any gestures that are added to the span's GestureRecognizers collection. For example, a TapGestureRecognizer has been added to the second Span in the above examples."/>
</FormattedString>
</Label.FormattedText>
</Label>
And here is the effect:
Upvotes: 0