MAUI Label inside layouts are not aligning properly
Satya
85
Reputation points
I have to show two labels side by side which are centered in a layout based on dynamic text. It was working fine in Xamarin forms, but not in MAUI.
Label is not centering and LineBreakMode is also not working.
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="MAUIAPP.MainPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<ScrollView>
<StackLayout
Margin="25"
HorizontalOptions="Center"
Orientation="Horizontal"
Spacing="0">
<!-- Worddwrap is not working and label is auto adjusting in maui -->
<Label
FontSize="16"
LineBreakMode="WordWrap"
Text="Please reach out me on this mobile number :" />
<Label
FontSize="16"
Text="1234567890"
TextColor="Blue">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped" />
</Label.GestureRecognizers>
</Label>
</StackLayout>
</ScrollView>
</ContentPage>