Bug 39509 - Setting Page Content doesn't work
Summary: Setting Page Content doesn't work
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-03-10 10:21 UTC by Petar Panic
Modified: 2016-04-08 14:03 UTC (History)
4 users (show)

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


Attachments
Example (1.48 KB, text/plain)
2016-03-10 10:21 UTC, Petar Panic
Details
Full working example (3.86 MB, application/x-zip-compressed)
2016-03-11 08:37 UTC, Petar Panic
Details
Example#2 (260.12 KB, application/x-zip-compressed)
2016-03-11 09:29 UTC, Petar Panic
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 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:
Status:
VERIFIED FIXED

Description Petar Panic 2016-03-10 10:21:25 UTC
Created attachment 15343 [details]
Example

As the title says it, setting Page Content from code doesn't work when doing first assignment. Second assignment sets it correctly for iOS. Android works fine

In the attachment is the code used (Note: code is called on SizeChanged event of the page and _newSchool and _archive is are custom controls).

I'm using Xamarin for Visual Studio with Xamarin.Forms.
Comment 1 E.Z. Hart [MSFT] 2016-03-10 19:41:10 UTC
Thank you for taking the time to submit the bug. We tried to reproduce the issue you reported but were unable given the description. If you could please attach a reproduction to the bug by starting with a clean Xamarin.Forms project and adding just the code necessary to demonstrate the issue we would very much appreciate it.

Also, please specify which version of Xamarin.Forms you are using.

Warm regards,
Xamarin Forms Team
Comment 2 Petar Panic 2016-03-11 08:37:35 UTC
Created attachment 15363 [details]
Full working example
Comment 3 Petar Panic 2016-03-11 08:47:55 UTC
Added additional attachment with a full solution that is able to reproduce the bug.

I'm using latest Xamarin.Forms which is at the moment 2.1.0.6526.

Last Xamarin.Forms that didn't exhibit this problem was 2.1.0.6505.

Sorry for the example that did not exhibit the issue, my time was limited yesterday to test it.

Sincerely,
Petar
Comment 4 Petar Panic 2016-03-11 09:29:45 UTC
Created attachment 15364 [details]
Example#2

Excluded all unnecessary projects.

Oh and one note - the bug occurs when rotating the device - first assignment works fine, but all later ones need multiple assignments to work.
Comment 5 Jason Smith [MSFT] 2016-03-13 11:46:41 UTC
Thank you, I have re-added this bug to the triage queue :)
Comment 6 Jason Smith [MSFT] 2016-03-27 22:52:32 UTC
private void RemoveFromParent(View view)
{
    var parent = view.Parent as Layout<View>;
    parent?.Children.Remove(view);
}

Add that method and call it before you call Children.Add in your GetPortraitLayout/LandscapeLayout methods. This will be done automatically for you in a future release.
Comment 7 Parmendra Kumar 2016-04-08 14:03:20 UTC
I have checked this issue with Xamarin.Forms 2.2.0-pre1 and its working fine.

Hence closing this issue.