ImageSource.FromFile in WinPhone and Image's properties

laantmiklaantmik FIMember
edited November 2017 in Xamarin.Forms

Hello All,
Has anyone of you noticed in code snippet like below which is reading Xamarin Application's (WinPhone version)
Images that Height and Width are not properly set. Image's Width and Heigth values are -1. In Android and iOS same code works well.

Image imgCard = new Image();
imgCard.Aspect = Aspect.AspectFit;
imgCard.Source = ImageSource.FromFile(MySettings.NameOfImage);

// Here in WinPhone imgCard's heigth and width are -1, but in Android and iOS they have correct values.

If I put: Task.Delay(800);
then values are correct. So, it seems to be so that in WinPhone these API calls doesn't work synchronously or something like that like they do in iOS and Android.

Is this a bug or are there some settings to be set into code if WinPhone version is deployed.

I have newest version of Xamarin Plugins in Visual Studio Project.


Sign In or Register to comment.