I'm trying to concatenate text in a Maui Label and I want part of the text to be bold. The examples I've found seem mostly for wpf and not Maui. This gives me the concatenated text:
<Label
x:Name="SecondTip"
FontSize="16"
VerticalOptions="Center"
HorizontalOptions="Start"
Text="{Binding FirstActionRowText, StringFormat='Recommendation: {0}'}"
/>
But how can I set 'Recommendation:' to Bold? I've been trying things like setting TextType to Html and adding Bold tags without success. Also interested in how I'd format the binding text too?
EDIT: I've achieved the bold formatting like this:
<Label x:Name="SecondTip">
<Label.FormattedText>
<FormattedString>
<Span Text="Recommendation: " FontAttributes="Bold" FontSize="16" />
<Span Text="{Binding FirstActionRowText}" FontSize="16" />
</FormattedString>
</Label.FormattedText>
</Label>
However, the result gives me slightly smaller text than when creating a normal label and setting Text, so it looks slight odd. How can I match the style of the default Label?
Based on your code, you may try set the character spacing bigger or smaller, just like:
Hope it works for you.