Repository metrics
- Stars
- (5,644 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
Description
Setting image source from file path works differently depending on file location and on Xamarin Forms version. The following code in xaml leads to different image sizes (see screenshots) with different Xamarin Forms versions.
<StackLayout Orientation="Vertical"> <Image Source="Octocat.png" Aspect="AspectFit"/> <Image Source= "/data/user/0/com.companyname.ImageSourceExample.Android/files/Octocat.png" Aspect="AspectFit"/> </StackLayout>
Images in drawable folder and in app folder are the same, but using Xamarin.Forms version 3.2.0.871581 (or lower) I get 2 same sized images and in version 3.3.0.912540 (or higher) I get second image much smaller.
I can reproduce this behavior only on Visual Studio Emulator for android, on real devices I have no such problem.
Steps to Reproduce
- Create new Xamarin Forms project in Visual Studio
- Add the same image to drawable folder and to the app folder on a virtual device
- Add two images with source from files from step 2.
- Start app on Visual Studio Android Emulator with different Xamarin Forms (3.2.0.871581 and 3.3.0.912540) versions.
Expected Behavior
Get same images sizes for the same code independently from Xamarin Forms version.
Actual Behavior
Different images sizes for the same code for different Xamarin Forms version
Basic Information
- Version with issue:3.3.0.912540
- Last known good version: 3.2.0.871581
- IDE: Visual Studio 2017, ver. 15.9.7
- Platform Target Frameworks:
- Affected Devices: Visual Studio Emulator for Android
Screenshots

Reproduction Link
https://github.com/dronishe/XamarinImagFromSourceExample
I’ve created a simple repo for reproduction. Last commit – same image size with older version of Xamarin Forms. Second to last commit – same code, differs only with Xamarin Forms version. Images have different size.