Xamarin Forms: Label LineBreakMode

You can set a LineBreakMode attribute to a Label that can have the following values:

  • TailTruncation
  • HeadTruncation
  • MiddleTruncation
  • CharacterWrap
  • WordWrap
  • NoWrap


If you have a text that is to large to fit the width of your label, you can use the attribute called LineBreakMode=TailTruncation.

This will display a text with “…” at the end (ellipsis) when the text doesn’t fit. Let’s take for example this text: “Welcome to Xamarin Forms” inside a Label like in the exmple below:

<?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:Test" x:Class="Test.MainPage">
    <StackLayout Orientation="Horizontal" HorizontalOptions="Fill" VerticalOptions="Center">
        <!-- Place new controls here -->
        <Button Text="Press Me" WidthRequest="150" HeightRequest="100" />
        <Label Text="Welcome to Xamarin Forms!" FontSize="Large"
        <Button Text="Press Me" WidthRequest="100" HeightRequest="100" />

The text is to long to fit the label width so it will display as much as it fits from the text with ellipsis at the end like in the image bellow:


HeadTruncation will display the ellipsis (…) at the beginning:


MiddleTruncation will display the ellipsis (…) in the middle:


CharacterWrap will wrap the word by character.


WordWrap will wrap by words.


NoWrap will let text to be displayed as much as it can.

Exit mobile version