60. LineBreakMode プロパティで折り返し方法などが指定できます。設定できる値は、CharacterWrap,
HeadTruncation, MiddleTruncation, NoWrap, TailTruncation, WordWrap になります。Wrap とつくものが
横幅に収まりきらないときに折り返しを行う設定で、Truncation とつくものが…でトランケートする設定に
なります。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:HelloWorld"
x:Class="HelloWorld.MyPage">
<ContentPage.Padding>
<OnPlatform x:TypeArguments="Thickness">
<On Platform="iOS">0,20,0,0</On>
</OnPlatform>
</ContentPage.Padding>
<StackLayout HorizontalOptions="Center"
VerticalOptions="Center">
<Frame WidthRequest="75">
<Label Text="This is a long long long long long long long long long text!!!!!!"
LineBreakMode="CharacterWrap" />
</Frame>
<Frame WidthRequest="75">
<Label Text="This is a long long long long long long long long long text!!!!!!"
LineBreakMode="TailTruncation" />
</Frame>
</StackLayout>
</ContentPage>
最初の Label は、文字単位での折り返しを指定しています。2 つ目の Label は、末尾でトランケートを指定し
ています。実行結果を以下に示します。