Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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 36932 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
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
Created attachment 14258 [details]
sample app and screenshots
In a fairly simple Grid it is not very difficult to get the layout of the child items to be off by one or more pixels. The results seem to vary by device, too.
The case shown by the attached sample app involves two horizontal StackLayouts in the same Grid column that *should* be right-aligned instead have their right edges visually offset by 1 px. This seems to be related to the fact that StackLayout.Spacing is set to a non-integer value (7.5). If you step through the code you can see that the Bounds.Right properties of the two StackLayouts are indeed offset by exactly 0.5.
The second case is actually device specific. On a 7" KitKat (4.4) XHDPI Tablet (1920x1200) running in the VS Emulator for Android, the grid elements along the bottom edge are all aligned. On a Kindle Fire HD (1280x800), the grid elements are not aligned. (see screenshots)
In the full app I am working on I have also seen a case where the right-most element in a StackLayout ends up positioned 1 px short of the right edge of the StackLayout, for no obvious reason. In that same case the two StackLayouts right-aligned in the Grid column were visually offset by 2 px.
This is really frustrating when trying to use Grids and StackLayouts to lay things out precisely on the screen. The layouts in the sample app are very simple with just a few Grid rows/cols and integer dimensions for almost everything. I would expect maybe a few extremely tiny rounding errors as a result of all layout properties being represented as doubles, but actually generating layouts with values apparently rounded somewhere along the way to the nearest whole integer is a serious problem.
Really need this stuff to work... :(
I have checked this issue with Xamarin.Forms.188.8.131.5290 and also getting same behaviour mentioned in bug description.
adb logcat: https://gist.github.com/Arpit360/e4112148ce506e208c2c
Microsoft Visual Studio Professional 2013
Version 12.0.40629.00 Update 5
Microsoft .NET Framework
Installed Version: Professional
Xamarin 184.108.40.206 (21aad62)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin.Android 220.127.116.11 (50280e4)
Visual Studio plugin to enable development for Xamarin.Android.
Xamarin.iOS 18.104.22.168 (122b860)
Visual Studio extension to enable development for Xamarin.iOS.
Re-confirmed on XHDPI Lollipop 5.0 Emulator Api 21 on master; box is off by a pixel
This is still a problem in 2.3.x. Would at least like a workaround.