Bug 22786 - Race condition - When a View's LayoutTo animation begins before the page is fully rendered, it starts moving from 0,0
Summary: Race condition - When a View's LayoutTo animation begins before the page is f...
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.2
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2014-09-09 12:06 UTC by Jakub Arnold
Modified: 2015-05-27 00:01 UTC (History)
5 users (show)

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 Jakub Arnold 2014-09-09 12:06:17 UTC
Here's the code that I used to reproduce the bug https://gist.github.com/darthdeus/4ae71f71997ae1430477

Basically the problem is that I'm starting the LayoutTo animation on the Button before the Content of the Page is set (which is probably before it gets rendered), which causes the animation to run from x=0, y=0 instead of the coordinates of the button.

I'm not really sure how to fix this, other than by inserting an arbitrary delay to the animation. Is there an event that gets called when the page is displayed and all the views' properties are known and calculated?
Comment 1 Seth Rosetter 2014-09-09 14:35:03 UTC
I have confirmed this issue. Thanks for the reproduction.
Comment 2 Jason Smith [MSFT] 2015-05-27 00:01:40 UTC
You should use the translation apis. LayoutTo is intended for usage by layouts and. This is expected behavior.