NoWrap Ignored In Label

Nathan Sokalski 4,116 Reputation points

I have a CollectionView in which the ItemTemplate contains a Grid, which has 2 ColumnDefinition(s): Auto & *. The second column contains a Label with LineBreakMode="NoWrap". When the text is too long to fit, I want it to be clipped (not wrapped), even if this means some of the text becomes not visible. However, the text seems like it is wrapping. Here is a screenshot:
The XAML for the Label is as follows:

<Label Grid.Column="1" HorizontalOptions="FillAndExpand" VerticalOptions="Fill" LineBreakMode="NoWrap" FontSize="36" HorizontalTextAlignment="Start" VerticalTextAlignment="Center" TextColor="Black" BackgroundColor="{Binding PlayerIndex,Converter={StaticResource Places},ConverterParameter=Color}" FontFamily="Arial" Margin="0" Padding="5,0,0,0" Text="{Binding NameTotal}"/>  

How can I cause the text to be clipped rather than wrapped? Isn't that what LineBreakMode="NoWrap" is supposed to do? Is this something I need to do in a Custom Renderer (in case it is of any significance here, I am using Android)? Thanks.

A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,293 questions
{count} votes

1 answer

Sort by: Most helpful
  1. JessieZhang-MSFT 7,706 Reputation points Microsoft Vendor


    Welcome to our Microsoft Q&A platform!

    How can I cause the text to be clipped rather than wrapped?

    If you want the long text to be clipped , you can try the following value( HeadTruncation, MiddleTruncation , TailTruncation) for property LineBreakMode


    Best Regards,

    Jessie Zhang

    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.