Reputation: 32798
Here's the code I was using:
<Label x:Name="detail3" Grid.Row="2" FontSize="35" XAlign="Center" VerticalOptions="Center" LineBreakMode="WordWrap" />
But I understand XAlign should no longer be used.
Upvotes: 0
Views: 437
Reputation: 18799
XAlign
has been deprecated for the better named HorizontalTextAlignment
Similarly YAlign
has been deprecated for VerticalTextAligment
So to horizontal align the text for your Label
you can do the following:
<Label x:Name="detail3" Grid.Row="2" FontSize="35" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" LineBreakMode="WordWrap" />
See https://developer.xamarin.com/api/type/Xamarin.Forms.Label/
HorizontalTextAlignment
Center, End, or Start, to indicate the horizontal placement of the label text.
VerticalTextAlignment
Center, End, or Start, to indicate the vertical placement of the label text.
Upvotes: 7
Reputation: 673
If you want to Label control in centre align use the -HorizontalOptions="Centre"
<Label x:Name="detail3" Grid.Row="2" FontSize="35" XAlign="Center" VerticalOptions="Center" HorizontalOptions="Centre" LineBreakMode="WordWrap" />
If you want to Label's text in centre align use the -HorizontalTextAlignment="Centre"
<Label x:Name="detail3" Grid.Row="2" FontSize="35" XAlign="Center" VerticalOptions="Center" HorizontalTextAlignment="Centre" LineBreakMode="WordWrap" />
Upvotes: -1
Reputation: 5
Please check Xamarin documentation Xamarin.Forms.Label.XAlign Property
Upvotes: 0