Bug 45773 - [iOS] Group Header does not expand to include all contents of ViewCell in GroupHeaderTemplate.
Summary: [iOS] Group Header does not expand to include all contents of ViewCell in Gro...
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 2.3.2
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-10-21 01:34 UTC by Jon Goldberger [MSFT]
Modified: 2018-01-17 12:23 UTC (History)
10 users (show)

Tags: iOS ac
Is this bug a regression?: ---
Last known good build:


Attachments
Test Project. (59.45 KB, application/zip)
2016-10-21 01:34 UTC, Jon Goldberger [MSFT]
Details
Correct Test Project (283.47 KB, application/zip)
2016-10-21 18:06 UTC, Jon Goldberger [MSFT]
Details
Corrected Test Project with Orange StackLayout (290.00 KB, application/zip)
2016-10-21 18:29 UTC, Jon Goldberger [MSFT]
Details


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 45773 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 Jon Goldberger [MSFT] 2016-10-21 01:34:45 UTC
Created attachment 18154 [details]
Test Project.

## Description

On iOS, the group header of a ListView does not expand based on the content of the ViewCell. This is true if the ViewCell has only one Label in it, or if the ViewCell has a StackLayout with multiple elements in it. 

## Steps to reproduce

1. Open the attached sample project (thank you Code Knox (SO) /NightOwl (Xam Forums)

2. Launch to iOS simulator or device. 

Expected result: The two green background labels will be entirely within the Orange background StackLayout, which is the first child element of the GroupHeaderTemplate's ViewCell. 
Screenshot: http://screencast.com/t/QTU6PcRmWxmg
Note that this was achieved just by setting the height of the ViewCell to 100, and obviously is not a solution as there is too much space for the header in the first group header, but enough for the second which has more text.

Actual result: The two green background labels extend below the orange background StackLayout
Screenshot: http://screencast.com/t/tsQkn1Pmtg

## Note

So it would seem that the calculation of the hight for the Header cell does not take into account the height of the child elements. The StackLayout (orange background) fills the full height and width of the header cell on iOS, but the labels (green background) extend outside of their parent StackLayout container. 

This bug was reported on SO [1] and the Xamarin Forums [2]

[1] http://stackoverflow.com/questions/40143384/listview-groupheadertemplate-with-fixed-height-on-ios
[2] https://forums.xamarin.com/discussion/80698/listview-groupheadertemplate-fixed-height-on-ios

## Environment

=== Xamarin Studio Enterprise ===

Version 6.1.1 (build 15)
Installation UUID: ceaba76c-db06-4fbd-b326-f69ea53c3e01
Runtime:
	Mono 4.6.1 (mono-4.6.0-branch-c8sr0/ef43c15) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 406010005

=== NuGet ===

Version: 3.4.3.0

=== Xamarin.Profiler ===

Version: 0.33.1
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 8.0 (11246)
Build 8A218a

=== Xamarin.Android ===

Version: 7.0.1.3 (Visual Studio Enterprise)
Android SDK: /Users/jongoldberger/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
		6.0   (API level 23)
		7.0   (API level 24)

SDK Tools Version: 25.2.2
SDK Platform Tools Version: 24.0.3
SDK Build Tools Version: 24.0.3

Java SDK: /usr
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Xamarin.iOS ===

Version: 10.0.1.10 (Visual Studio Enterprise)
Hash: ad1cd42
Branch: cycle8-sr0-xi
Build date: 2016-10-03 15:18:44-0400

=== Xamarin.Mac ===

Version: 2.10.0.105 (Visual Studio Enterprise)

=== Xamarin Inspector ===

Version: 0.10.0.0
Hash: e931a52
Branch: master
Build date: Thu, 18 Aug 2016 17:46:46 GMT

=== Build Information ===

Release ID: 601010015
Git revision: fa52f02641726146e2589ed86ec4097fbe101888
Build date: 2016-09-22 08:03:02-04
Xamarin addins: 75d65712af93d54dc39ae4c42b21dfa574859fd6
Build lane: monodevelop-lion-cycle8-sr0

=== Operating System ===

Mac OS X 10.12.0
Darwin Jons-MacBook-Pro.local 16.0.0 Darwin Kernel Version 16.0.0
    Mon Aug 29 17:56:20 PDT 2016
    root:xnu-3789.1.32~3/RELEASE_X86_64 x86_64

=== Enabled user installed addins ===

Xamarin Inspector 0.10.0.0
Comment 2 Night Owl 2016-10-21 03:41:47 UTC
Thank you Jon for creating the bug.

I just discovered that this is also happening for entries on the list view itself.

Sometimes I had to scroll all the way to the bottom to see text from one entry overwriting the text, sometimes just opening and this happens.

Unfortunately, because I'm under NDA I can't post the screenshot here, but if needed, I can try to repro in another project also.
Comment 3 Jon Goldberger [MSFT] 2016-10-21 18:06:45 UTC
Created attachment 18169 [details]
Correct Test Project

Accidentally uploaded the wrong test project. This is the correct one.
Comment 4 Jon Goldberger [MSFT] 2016-10-21 18:14:08 UTC
Just discovered a workaround. Based on a similar bug report bug #41869, if you wrap the StackLayout in another StackLayout, then the header cells size properly on iOS. 

E.g. 

><ListView.GroupHeaderTemplate>
>    <DataTemplate>
>        <ViewCell>
>            <StackLayout>
>                <StackLayout
>                    Padding="15,10,15,10"
>                    Spacing="0"
>                    BackgroundColor="Green">
>                    <Label
>                        Text="{Binding LongName}"
>                        Margin="0,0,0,3"
>                        LineBreakMode="WordWrap"
>                        TextColor="White"
>                        BackgroundColor="Green"
>                        FontSize="14" />
>                    <Label
>                        Text="{Binding Description}"
>                        LineBreakMode="WordWrap"
>                        TextColor="White"
>                        BackgroundColor="Green"
>                        FontSize="11" />
>                </StackLayout>
>            </StackLayout>
>        </ViewCell>
>    </DataTemplate>
></ListView.GroupHeaderTemplate>
Comment 5 Jon Goldberger [MSFT] 2016-10-21 18:16:28 UTC
@NightOwl,

We'll need a new bug report for the issue brought up in comment 2. When you create a repro for it, feel free to file the bug report following the template here. If you think the issue is related, you can reference this bug report from the new one.
Comment 6 Jon Goldberger [MSFT] 2016-10-21 18:24:02 UTC
Oops, the workaround in comment 4 does make the two labels stay fully inside the orange background StackLayout, but the header cell still extends below where it should and covers or partially covers items in the list. Same is true if you just remove the padding from the StackLayout. 

So unfortunately I do not have a workaround at this time.
Comment 7 Jon Goldberger [MSFT] 2016-10-21 18:29:09 UTC
Created attachment 18170 [details]
Corrected Test Project with Orange StackLayout
Comment 8 Anders Bech Mellson 2017-09-08 19:50:58 UTC
Any update on this one?
Comment 9 Anonymous 2017-09-21 20:57:21 UTC
Bump. This issue is also present with Grids in that the cell does not expand to show the full contents of the grid.
Comment 10 kyle.spearrin 2017-11-29 20:25:49 UTC
Still seeing this over a year later. Any update?
Comment 11 tim.ahrentlov 2017-12-07 15:03:40 UTC
A fix guys?