-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
I am trying to implement dynamic loading items to ListView in Xamarin.Forms, but I cannot get it working. ListView loads whole collection instead of first page only. The method GetItemsAt of IPagedSourceProvider is called many times, until the end of data source.
Maybe someone can provide working example for Xamarin.Forms (best would be for WinRT platform)?
my code is:
public class PagedCollectionProvider<T> : AlphaChiTech.Virtualization.IPagedSourceProvider<T>
{
private IEnumerable<T> Collection;
public PagedCollectionProvider(IEnumerable<T> Collection)
{
this.Collection = Collection;
}
public int Count
{
get
{
var coll = Collection as ICollection<T>;
if (coll != null)
return coll.Count;
return Collection.Count();
}
}
public PagedSourceItemsPacket<T> GetItemsAt(int pageoffset, int count, bool usePlaceholder)
{
return new PagedSourceItemsPacket<T>()
{
LoadedAt = DateTime.Now,
Items = Collection.Skip(pageoffset).Take(count)
};
}
public int IndexOf(T item)
{
var list = Collection as IList<T>;
if (list != null)
return list.IndexOf(item);
return Collection.IndexOf(item);
}
public void OnReset(int count)
{
}
}
Metadata
Metadata
Assignees
Labels
No labels