You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you use CachedImage views inside ViewCells used by ListViews with ListViewCachingStrategy.RecycleElement enabled, don't rely on bindings for setting the Source property (they are so slow!) - please use ViewCell's OnBindingContextChanged override of a ViewCell implementation to update it, avoiding loading images to wrong views. Example:
public class MyCustomCell : ViewCell
{
readonly CachedImage cachedImage = null;
public MyCustomCell()
{
cachedImage = new CachedImage();
View = cachedImage;
}
protected override void OnBindingContextChanged()
{
// you can also put cachedImage.Source = null; here to prevent showing old images occasionally
cachedImage.Source = null;
var item = BindingContext as Item;
if (item == null)
{
return;
}
cachedImage.Source = item.ImageUrl;
base.OnBindingContextChanged();
}
}
https://github.com/luberda-molinet/FFImageLoading/wiki/Xamarin.Forms-Advanced
https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/listview/performance#RecycleElement
The text was updated successfully, but these errors were encountered: