You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 1, 2024. It is now read-only.
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
Open the attached sample project (thank you Code Knox (SO) /NightOwl (Xam Forums)
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 the above expected result 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 originally reported on SO [1] and the Xamarin Forums [2] 2.5 years ago.
This was originally filed on bugzilla: https://bugzilla.xamarin.com/show_bug.cgi?id=45773
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
Open the attached sample project (thank you Code Knox (SO) /NightOwl (Xam Forums)
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 the above expected result 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 originally reported on SO [1] and the Xamarin Forums [2] 2.5 years ago.
[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
Screenshots
These are from the original bug report, so they are of an older simulator, but it looks the same on an iOS iPhone Xr 12.2 simulator.
Screenshot expected: http://screencast.com/t/QTU6PcRmWxmg
Screenshot actual: http://screencast.com/t/tsQkn1Pmtg
Reproduction Link
GroupHeaderTemplateLayoutErroriOS.zip
The text was updated successfully, but these errors were encountered: