Reputation: 55
var image = await PicturePicker.PickImage();
Image img = ImageSource.FromStream(image);
My code is as shown above. image is a stream returned from the picture picker and i fed it to the FromStream function in xamarin forms but it thorws me the following error Argument type 'System.IO.Stream'is not assignable to parameter type System.Func
Any kind soul able to help me out with this?
Upvotes: 0
Views: 110
Reputation: 445
I think instead of Image img. You should use ImageSource img
public ImageSource Imgsrc;
and try this code
Imgsrc = ImageSource.FromStream(() =>
{
return image;
});
Actually this is how I do to load the images to my ViewModel.Hope it helps
Upvotes: 2