1
votes

I have changed my ImageCell to a custom ViewCell holding am image and three labels.

The ImageCell was loading images for cells just when they appear on the screen. My custom cell loads all images of all ViewCells during the initial load.

How can I fix this, or how can I enhance my custom ViewCell to implement the same behaviour?

Thanks, Nikolai

2
Please add some codeSreeraj
It's really necessary to review your custom cell code.Mikalai Daronin

2 Answers

5
votes

In your CustomViewCell you just need to override OnAppearing and OnDisappearing.

Both events are called while scrolling

public class MyCell : ViewCell
{
    protected override void OnAppearing()
    {
        base.OnAppearing();
        // Do what happens on appeaering - load image
    }

    protected override void OnDisappearing()
    {
        base.OnDisappearing();
        // Do what happens on disappeaering - unload image
    }

    public MyCell()
    {
    }
}
4
votes

As long as you aren't loading it up anywhere in the background, if your list view is set to recycle the cells, it should not load them until they are in view.

<ListView CachingStrategy="RecycleElement">