I\'m using Xamarin and creating my view with XAML and I cannot for the life of me get this label to wrap the way I want it to. If the label gets to the edge of the screen, I
You can achieve the desired look by combining both of the Labels contained in your horizontally aligned StackLayout into a single Label and setting LineBreakMode="WordWrap". XAML has a great feature known as StringFormat. You can use this to prepend the static "Certification Board:" text to the bound Certification property. Your Label should look like this:
<Label Text="{Binding Certification, StringFormat='Board Certification:{0:F0}'}" LineBreakMode="WordWrap"/>
Add two columns to your grid and remove stacklayout around the labels, as shown below
<StackLayout Orientation="Vertical" HorizontalOptions="StartAndExpand" BindingContext="{Binding CurrentProviderDetails}" Padding="20,20,20,20" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!--Certification Board-->
<Label Grid.Row="0" Grid.Column="0" Text="Certification Board: " FontSize="13" HorizontalOptions="FillAndExpand" />
<Label Grid.Row="0" Grid.Column="1" Text="{Binding Certification}" HorizontalOptions="FillAndExpand" Font="17"/>
</Grid>
</StackLayout>
You can more rows like this by adding like below
<Label Grid.Row="1" Grid.Column="0" Text="Certification Name: " FontSize="13" HorizontalOptions="FillAndExpand" />
<Label Grid.Row="1" Grid.Column="1" Text="{Binding CertificationName}" HorizontalOptions="FillAndExpand" Font="17"/>
Put a LineBreakMode="NoWrap" tag in your labels. This way you can avoid the wrap.
But if you don't have enough space, the word will be cut.