xamarin/Xamarin.Forms

[Bug] Label Truncation inconsistent between StackLayout and Grid

开放

#6,246 创建于 2019年5月21日

 (3 条评论) (0 个反应) (0 位负责人)C# (1,926 个派生)batch import
a/layoute/6 :clock6:help wantedi/lowt/bug :bug:up-for-grabs

仓库指标

星标
 (5,644 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

Description

I have two labels in a horizontal StackLayout. The second is set to TailTruncation as it is sometimes a long string. This was causing the first to wrap onto two lines. So I then set the LineBreakMode="NoWrap" for that one and the second control is still overlapping the first control as if it was wrapping the text. How do I stop this from happening? I want the first control to show the entire label.

I implemented the two controls in a Grid and it acts as expected. Since I have a workaround it is not blocking, but the two layouts should be consistent

Steps to Reproduce

  1. Here's the code
<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height = "Auto" />
    </ Grid.RowDefinitions >
    < Grid.ColumnDefinitions >
        < ColumnDefinition Width="Auto" />
        <ColumnDefinition Width = "Auto" />
    </ Grid.ColumnDefinitions >
    < Label Grid.Column="0" Text="APPLICATION" FontSize="Small" FontAttributes="Bold" TextColor="Gray"
                                LineBreakMode="NoWrap" HorizontalOptions="StartAndExpand"/>
    <Label Grid.Column="1" Text= "Super long string that should be truncated, but somehow fit on the screen." HorizontalTextAlignment= "End"
                                FontSize= "Small" HorizontalOptions= "End" FontAttributes= "None" TextColor= "Gray"
                                LineBreakMode= "TailTruncation" />
</ Grid >
< StackLayout Orientation= "Horizontal" >
    < Label Text= "APPLICATION" FontSize= "Small" FontAttributes= "Bold" TextColor= "Gray"
                                LineBreakMode= "NoWrap" HorizontalOptions= "StartAndExpand" />
    < Label Text= "Super long string that should be truncated, but somehow fit on the screen." HorizontalTextAlignment= "End"
                                FontSize= "Small" HorizontalOptions= "End" FontAttributes= "None" TextColor= "Gray"
                                LineBreakMode= "TailTruncation" />
</ StackLayout >

Expected Behavior

Stack should layout the same as the Grid

Actual Behavior

First control in the Stack gets clipped.

Basic Information

  • Version with issue: 3.6.0.264807
  • Last known good version: ??
  • IDE: Visual Studio 2019
  • Platform Target Frameworks:
    • iOS: 12.2
    • Android: 8.1
    • UWP: N/A
  • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices: iOS and Andriod

Screenshots

image

Reproduction Link

贡献者指南