Bug 27016 - Incorrect placement of StackLayout within AbsoluteLayout
Summary: Incorrect placement of StackLayout within AbsoluteLayout
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.4
Hardware: Macintosh Mac OS
: High normal
Target Milestone: 1.3.4
Assignee: Bugzilla
Depends on:
Reported: 2015-02-12 17:59 UTC by Geoff Armstrong
Modified: 2015-02-13 06:39 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 Geoff Armstrong 2015-02-12 17:59:33 UTC
We have a horizontal StackLayout within an AbsoluteLayout, using the AbsoluteLayout to make the StackLayout placed in the top right. When items in the StackLayout are shown, everything is fine, but when you hide something, instead of the StackLayout's top right corner matching the AbsoluteLayout's top right corner, it seems like the AbsoluteLayout is laying it out as if the StackLayout's width was zero or something. The StackLayout overflows to the right.

Here is a minimal repro; just take a blank project and replace App.cs with this:

using Xamarin.Forms;

namespace TestStackLayout {
	public class App : Application {
		public App()
			MainPage = new ContentPage {
				Content = new AbsoluteLayout {
					Children = {
						new StackLayout {
							// The padding is here to allow you to see the edge peeking out
							Padding = new Thickness(0, 20, 20, 0),
							Orientation = StackOrientation.Horizontal,
							Children = {
								// Normal button.
								new Button { Text = "Button 1" },

								// Hidden button. Uncomment to see the bug.
								//new Button { Text = "Button 2", IsVisible = false },

	public static class ExtensionMethods {
		public static T AbsoluteLayoutTopRight<T>(this T view) where T : View
			AbsoluteLayout.SetLayoutFlags(view, AbsoluteLayoutFlags.PositionProportional);
			AbsoluteLayout.SetLayoutBounds(view, new Rectangle(1.0, 0.0, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
			return view;

Then uncomment line 19, the hidden button, to trigger the bug.

Worked fine in 1.3.3.
Comment 1 Ram Chandra 2015-02-12 23:35:04 UTC
I have check this issue and I am able to reproduce this issue.

Observation: When I set the ISVisible property to false in attached project, I observed that Xamarin.Forms shows incorrect placement of control in stack layout within absolute layout. I am getting this issue on both Android and iOS.

Screencast: (iOS) : http://www.screencast.com/t/SGfcuHbl
                    (Android) : http://www.screencast.com/t/dPqcRbSrne

IDE logs: https://gist.github.com/saurabh360/b6583f7499b7f0663215

Additional Info: It is a regression. I am not getting this issue with

Please let me know if I can provide more info to this issue.

Environment Info:


=== Xamarin Studio ===

Version 5.7.1 (build 17)
Installation UUID: 6ea47b0d-1852-4aaf-808d-373ff0a5002b
	Mono 3.12.0 ((detached/a813491)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068

=== Apple Developer Tools ===

Xcode 6.1 (6604)
Build 6A1052d

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 09ae75f
Build date: 2015-02-11 22:34:42-0500

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/jatin66/Desktop/Backup/android-sdk-macosx
	Supported Android versions:
		1.6    (API level 4)
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.1    (API level 12)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin.Mac ===

Version: (Business Edition)

=== Build Information ===

Release ID: 507010017
Git revision: 0bc7d3550b6b088ac25b08dcf7bbe73bcc8658b3
Build date: 2015-02-03 19:43:29-05
Xamarin addins: f7b7d34419c9ec24501bfa7c658e80a6305613e0

=== Operating System ===

Mac OS X 10.10.0
Darwin Jatin66s-iMac.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Comment 2 Jason Smith [MSFT] 2015-02-13 03:19:20 UTC
Should be fixed in 1.3.4-pre4
Comment 3 Parmendra Kumar 2015-02-13 06:39:59 UTC
I have checked this issue with and now its working fine at my end.

Hence closing this issue.