Bug 59968 - On iOS a ListView with a Label in the ViewCell requires an extra "\n" for multi-line text
Summary: On iOS a ListView with a Label in the ViewCell requires an extra "\n" for mul...
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms (show other bugs)
Version: 2.4.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-10-04 16:56 UTC by Will Autio
Modified: 2017-11-14 00:48 UTC (History)
4 users (show)

Tags: listview, label, multiline, ac
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 59968 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description Will Autio 2017-10-04 16:56:38 UTC
In code, I have an ObservableCollection where each member is set up like this:
string sampleText = "line 1" + "\n" + "line 2" + "\n" +"line 3" + "\n" +"line 4"

Then the collection is bound to a ListView and sampleText is bound to a label. The XAML is like this:
    <ListView x:Name="ProjectsLV"  
              BackgroundColor="White"
              ItemTapped="LV_ItemTapped"
              HasUnevenRows="True"
              SelectedItem="{Binding PM.SelectedItem, Mode=TwoWay}"
              IsPullToRefreshEnabled="True"
              RefreshCommand="{Binding RefreshProjectsCommand}"
              IsRefreshing="{Binding IsBusyAvoidRunningTwice, Mode=OneWay}" >

        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>

                    <Label Text="{Binding sampleText}" FontSize="20" TextColor="Black" Margin="5,5,5,5" />

                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>

In Android, I get a Label with 4 lines of text, as expected.

In iOS, I only get the first three lines of text for each cell in the ListView.

However, when I append an extra 
+ "\n"
to the text so it looks like:
string sampleText = "line 1" + "\n" + "line 2" + "\n" +"line 3" + "\n" +"line 4" + "\n"
then I get all 4 lines in iOS.
Comment 1 Paul DiPietro [MSFT] 2017-10-10 17:30:00 UTC
Until we can look into this further I'll set it as confirmed since it does behave as described. I can't imagine this is desired.
Comment 2 adrianknight89 2017-10-28 18:35:00 UTC
Is this an iOS 11 issue? How did it behave in prior iOS version?