I am using a FormattedString to Display a customized text on a Label on Xamarin.Forms. What I am trying to achieve is to change the color of one or more of the elements, for example: $$$$. But even though I am changing the color the Label just displays all the dollar symbols with the same color: $$$$
This is the Label on the view:
<Label Text="{Binding AveragePrice, StringFormat='{0}'}" HorizontalTextAlignment="Center" />
And this is the code of the property bound to the label text on the ViewModel
public FormattedString AveragePrice
{
get
{
return new FormattedString
{
Spans =
{
new Span { Text = "$", ForegroundColor=Color.Black },
new Span { Text = "$", ForegroundColor=Color.Black },
new Span { Text = "$", ForegroundColor=Color.Gray },
new Span { Text = "$", ForegroundColor=Color.Gray }
}
};
}
}
Why this code doesn't change the color of the dollar symbols? How can I make it happen?