I have a label with formatted text and I wanna change its font style(I mean typeface). I tried using Custom Label Rendering( like doing it for the normal text) ,but it is not getting reflected. My doubt is whether we can change typeface of formatted text (since it is working fine for text (not formatted text) of label).
This is my .xaml file code
<Label x:Name = "invosTitle" Grid.Column = "0" Grid.Row = "0" Grid.ColumnSpan = "3" HorizontalOptions = "CenterAndExpand">
<Label.FormattedText>
<FormattedString>
<FormattedString.Spans>
<Span Text = "abcd" ForegroundColor = "White" ></Span>
<Span Text = " "></Span>
<Span Text = "efgh" ForegroundColor = "Gray"></Span>
</FormattedString.Spans>
</FormattedString>
</Label.FormattedText>
</Label>
and CustomLabelRenderer code is
protected override void OnElementPropertyChanged (object sender , PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
var label = (TextView)Control;
Typeface font = Typeface.CreateFromAsset (Forms.Context.Assets, "Fonts/microsoftjhengheibold.otf");
label.Typeface = font;
label.SetTypeface (font, TypefaceStyle.Bold);
}