How do I change the text color of a specific part of a Label’s text in XAML?

Platform: .NET MAUI| Category: Controls

You can use formatted text with Span elements to change the color of specific parts of the text.

<Label>
	<Label.FormattedText>
		<FormattedString>
			<Span Text="Red" TextColor="Red" />
			<Span Text="Black" TextColor="Black" />
		</FormattedString>
	</Label.FormattedText>
</Label>

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.