0

I am trying to load image from url to an image view in xamarin forms application. But I am getting an error and I am not getting a fix for it.

I am trying to load the image as shown below:

ImageService.Instance
            .LoadFile(imageUrl)
            .LoadingPlaceholder("user.png")
            .Into(btn_profile_pic)
            .Source(btn_profile_pic);

I have tried using only Into and also only Source, but I get the following error:

String does not contain a definition for Into and no extension method 'Into' accepting a first argument of type during could be found

If I try using Source I get the following error:

Non Invocable member TaskParameter.Source cannot be used like a method

btw_profile_pic is an Image widget, I want to load the image from url into the image widget.

Cœur
  • 37,241
  • 25
  • 195
  • 267
focus
  • 25
  • 1
  • 9

1 Answers1

0

UPDATE:

Using Xamarin Forms:

XAML

<ffimageloading:CachedImage
        Source="{Binding imageUrl}"
        LoadingPlaceholder="user.png" />

Code:

var yourImage = new CachedImage()
{
    HorizontalOptions = LayoutOptions.FillAndExpand,
    Source = imageUrl,
    Aspect = Aspect.AspectFill,
    LoadingPlaceholder = "user.png"
};

As you can see there's not Into() method but you rely on the CachedImage class which will do most of the job for you.

You need to install the same Form package in every application project (iOS, Android and UWP) and you will need to init the Renderer with this line.

CachedImageRenderer.Init();

Here is a full documentation of how to use this library.

Hope this helps!

pinedax
  • 9,246
  • 2
  • 23
  • 30
  • My bad, sorry I have edited the question, it was copy paste error. Even after adding the parenthesis, I get the same error. – focus Mar 13 '17 at 06:02