Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

ImageSource.FromStream()

$
0
0

Hi, I've been trying to get an image inside of a frame to display onscreen. Currently, I have a property in my ViewModel which is bound to from Xaml. When the image source is set in Xaml to a local file instead of this bindable source, the image displays just fine, but when the bindable property is used, there is no image, no error, or anything else suggesting a problem - just no image.

try{
_currentRecipe = await _recipeWebService.GetRecipe ();
_backRecipe = await _recipeWebService.GetRecipe ();
var currentPhotoStream = _currentRecipe.PhotoStream;
Debug.WriteLine(currentPhotoStream.Length);
currentPhotoStream.Position = 0;
FrameImage1 = ImageSource.FromStream(()=>currentPhotoStream);
}
catch(Exception exception) {
Debug.WriteLine (exception.ToString());
}

This is the current code I am using to change the bound property. I'm truly at a loss on how to fix this. The stream is of the correct length according to the web-server, and saving the stream into a file that I exported using Android Device Monitor resulted in a valid jpg file on my workstation tat opened normally.

Cheers


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>