Computer Magic Logo
Formatted text in XAML

Monday, April 11, 2016

Published by Aristotelis Pitaridis

Below we have an example of how to use the formatted text inside the XAML file.

<Label x:Name="MyLabel">
  <Label.FormattedText>
    <FormattedString>
      <Span Text="Hello " FontAttributes="Bold" ForegroundColor="Red" BackgroundColor="Yellow" />
      <Span Text="World" FontAttributes="Italic,Bold" ForegroundColor="White" BackgroundColor="Blue" FontSize="Large" />
    </FormattedString>
  </Label.FormattedText>
</Label>