Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

It is better to use Label.FormattedText instead of Labels in an horizontal StackLayout?

$
0
0

Hello.

For a ListView, I want to show some labels, in the same line but with different style.

My question is if, in terms of performance, is it better to use Label.FormattedText instead of an StackLayout with some Labels?

this...

<Label>
  <Label.FormattedText>
    <FormattedString>
      <FormattedString.Spans>
          <Span Text="Red, " ForegroundColor="Red" FontAttributes="Italic" FontSize="20" />
          <Span Text=" blue, " ForegroundColor="Blue" FontSize="32" />
          <Span Text=" and green! " ForegroundColor="Green" FontSize="12"/>
      </FormattedString.Spans>
    </FormattedString>
  </Label.FormattedText>
</Label>

or...

            <StackLayout Orientation="Horizontal">
              <Label Text="Red" TextColor="Red"/>
              <Label Text="Blue" TextColor="Blue"/>
            </StackLayout>

What would it be better, in terms of performance?

Thanks!! :)


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>