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)

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


Attachments

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?

Note You need to log in before you can comment on or make changes to this bug.