Bug 46501 - On iOS, Grid children are not visible when changing grid visibility, children, row- and column-definition in certain order
Summary: On iOS, Grid children are not visible when changing grid visibility, children...
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.4
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-11-04 17:00 UTC by Stephan Palmer
Modified: 2017-03-20 03:08 UTC (History)
3 users (show)

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

Example code (3.96 KB, application/octet-stream)
2016-11-04 17:00 UTC, Stephan Palmer
Complete test app (11.71 KB, application/zip)
2016-11-10 07:50 UTC, Stephan Palmer

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 46501 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:

Description Stephan Palmer 2016-11-04 17:00:00 UTC
Created attachment 18343 [details]
Example code

We experienced a strange relationship between Grid properties IsVisible, Children, RowDefinitions, and ColumnDefinitions. When manipulating all these properties, in some cases children do not become visible as expected.

The scenario is:

* Clear current Children and Row-/ColumnDefinitions. They must not be empty.
* Set IsVisible=false.
* Add new instances to children and Row-/ColumnDefinitions.
* Set IsVisible=true.
* Children are not visible as expected.

Changing the view hierarchy somewhere else fixes the problem. I assume that this forces a re-layout. Also, any other order of doing this seems to work ok.

We could observe the behavior with:

* Xamarin.Forms amd Xamarin.Forms
* iOS 9.3.1 and iOS 10.0.2

Attached is an example app:

* Use the upper button to toggle the grid children. Notice that the first show works, the second show does not work.
* Use the lower button to trigger a view hierarchy change, after which the children are visible.
* Look at the ToggleGrid() method to observe or manipulate the call order of property changes.
* Observe the console log to notice that the children X, Y, Width and Height are not updated when the problem occurs.
Comment 1 Stephan Palmer 2016-11-10 07:50:18 UTC
Created attachment 18402 [details]
Complete test app

I'm attaching the complete example, it should be able to demonstrate the unrelated problem mentioned here: http://stackoverflow.com/questions/40512273/xamarin-xbuild-warning-when-building-shproj-files.
Comment 2 Paul DiPietro [MSFT] 2017-03-17 15:09:25 UTC
Thanks for the reproduction which does show the behavior, and for good measure I've checked it against the latest prerelease and nightly builds as well. It does look to occur on Android, too, so this will require further investigation.