Bug 41933 - Using column definition with Width = new GridLength(1, GridUnitType.Star) makes ViewCell height be calculated incorrectly
Summary: Using column definition with Width = new GridLength(1, GridUnitType.Star) mak...
Status: RESOLVED DUPLICATE of bug 37862
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.2.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-06-17 14:40 UTC by John Hardman
Modified: 2016-06-24 17:06 UTC (History)
3 users (show)

Tags: Xamarin.Forms ViewCell ListView Grid Width Height
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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description John Hardman 2016-06-17 14:40:54 UTC
I have a ListView with uneven rows. When I add a ViewCell to this ListView, the height of the row for that cell can be very wrong. Using BackgroundColor on the content of the ViewCell, I can see that the content is the right height, but the ViewCell is drawn with the wrong height (typically much too large).

After long investigation, I found the trigger for the incorrect height. Strangely, it is a Width property.

Within the UI hierarchy within the ViewCell, I have a Grid that is 2 columns wide and 1 column high.
Initially, I had both column definitions set to have Width = new GridLength(1, GridUnitType.Star) 
However, it turns out that even setting one column definition Width to use new GridLength(1, GridUnitType.Star) makes the ViewCell end up with an incorrect Height.

The workaround for my particular scenario was to set the column definition Width = GridLength.Auto for both columns.

                _columnDefinition1 = new ColumnDefinition
                    Width = GridLength.Auto // Using new GridLength(1, GridUnitType.Star) here makes the ViewCell height incorrect

I see this probably most vividly on Android.
Comment 1 John Hardman 2016-06-17 15:07:24 UTC
I should have mentioned that I am using XF
Comment 2 John Hardman 2016-06-17 15:09:28 UTC
Sorry, make that - NuGet is going through one of its phases where it shows the wrong numbers again :-( Time for a re-start.
Comment 3 Samantha Houts [MSFT] 2016-06-24 17:06:10 UTC
I am fairly certain this has the same root cause as 37862.

*** This bug has been marked as a duplicate of bug 37862 ***