Bug 27729 - Image does not scale with Aspect when inside a StackLayout with a WidthRequest
Summary: Image does not scale with Aspect when inside a StackLayout with a WidthRequest
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.5
Hardware: PC Mac OS
: High normal
Target Milestone: ---
Assignee: Bugzilla
: 42109 ()
Depends on:
Reported: 2015-03-06 08:32 UTC by John Miller [MSFT]
Modified: 2017-08-29 03:53 UTC (History)
13 users (show)

Tags: Android, iOS, ac, image, aspect, layout
Is this bug a regression?: ---
Last known good build:

Test Case (177.14 KB, application/zip)
2015-03-06 08:32 UTC, John Miller [MSFT]

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 27729 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 John Miller [MSFT] 2015-03-06 08:32:29 UTC
Created attachment 10186 [details]
Test Case


   The attached sample has an Image that should fill the width of the StackLayout that is in it. 

**Steps to Reproduce:**

   1. Run the attached sample on an Android emulator. I tested on API 19 Nexus 5.

**Actual Results:**


   The Image does not fit the width

**Expected Results:**

   The Image should scale to Fit the Width because there is plenty of vertical space left (blue arrows in http://screencast.com/t/RRdJmiK6lV7)

**Build Date & Platform:**

   XF 1.3.5

**Additional Information:**

   It shouldn't matter if the 430x430 image is "smaller" than 300x300 units. It should scale with AspectFit into the available space. Since there is remaining vertical space left in the layout, it is expected to continue scaling. It appears that once the "top" of the image reaches the "top" of the stacklayout it stops scaling. Instead, it needs to consider the layout space it has below as well. Removing the other element in the StackLayout frees up a lot of vertical space, yet it still does not scale: http://screencast.com/t/sl08jY6SoHw
If the VerticalOption is set to FillAndExpand, than it will scale the horizontal space: http://screencast.com/t/iXksPdS46
Comment 1 asimk 2015-03-25 07:26:10 UTC
I have checked this issue with the help of Bug description and I am not able to reproduce this. I observed that image is fit to layout whether it is 430x430 or 300x300 units. I have checked this on XF 1.3.5 and XF both. Please review the screencast and let me know what additional steps we need to follow to reproduce this issue.
Screencast: http://www.screencast.com/t/ke6f6hy2akM

I have checked this issue with emulator/device and getting same behavior on both.

Ide Log: https://gist.github.com/saurabh360/2f6c388000b297af7057

Environment Info:
=== Xamarin Studio ===

Version 5.8.2 (build 5)
Installation UUID: 0b7eaebc-a0ed-4b58-81df-91e378cad28c
 Mono 3.12.1 ((detached/0849ec7)
 GTK+ 2.24.23 (Raleigh theme)

 Package version: 312010003

=== Apple Developer Tools ===

Xcode 6.2 (6776)
Build 6C131e

=== Xamarin.iOS ===

Version: (Enterprise Edition)
Hash: 50919fe
Build date: 2015-03-23 17:10:22-0400

=== Xamarin.Android ===

Version: (Enterprise Edition)
Android SDK: /Users/Admin_Mac/Desktop/Anddk/android-sdk-macosx
 Supported Android versions:
  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_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: (Enterprise Edition)

=== Build Information ===

Release ID: 508020005
Git revision: 541c06a4f6c95383333375d56fd6c23ce48cb916
Build date: 2015-03-20 09:23:08-04
Xamarin addins: 02510c4990dee3475c282b3182d588975a63ff07

=== Operating System ===

Mac OS X 10.10.2
Darwin Admin-Macs-Mac-mini.local 14.1.0 Darwin Kernel Version 14.1.0
    Thu Nov 13 18:36:56 PST 2014
    root:xnu-2782.10.65~2/RELEASE_X86_64 x86_64
Comment 3 John Miller [MSFT] 2015-12-03 18:34:12 UTC
Updating status with new project sample.
Comment 5 Samantha Houts [MSFT] 2016-06-24 17:26:34 UTC
*** Bug 42109 has been marked as a duplicate of this bug. ***
Comment 6 Paul DiPietro [MSFT] 2017-06-16 18:47:02 UTC
Still exists against the latest 2.3.6 nightly.