Search This Blog

Wednesday 14 October 2020

How to Add New Line in Label Xamarin Forms.

 MainPage.xaml

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:TestProject"
             xmlns:system="clr-namespace:System;assembly=netstandard"       
             x:Class="TestProject.MainPage">
	      <StackLayout Margin="10">
		<Label>
                    <Label.FormattedText>
                        <FormattedString>
                            <Span Text="FirstLine text" />
                            <Span Text="{x:Static system:Environment.NewLine}"/>
                            <Span Text="{SecondLine text" />
                        </FormattedString>
                    </Label.FormattedText>
                </Label>
             </StackLayout>
</ContentPage>
 

1 comment:

  1. It really worked. A very simple and concise solution. Thank you.

    ReplyDelete

Popular Posts