CollectionView is being groomed as a replacement for ListView. However, due to a lack of real data virtualization it is not a viable option for many scenarios. While CollectionView does support "incremental data load", it is up to the consumer to swap new data in and is cumbersome to say the least. At a minimum, the eager loading of the entire data source is not expected behavior.
Steps to Reproduce
Define a data source:
public class Source : IReadOnlyList<string>
{
public IEnumerator<string> GetEnumerator()
{
return Enumerable.Range(0, 100).Select(i =>
{
Debug.WriteLine($"Enumerator: {i}");
return i.ToString();
}).GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public int Count => 100;
public string this[int index]
{
get
{
Debug.WriteLine($"Indexer: {index}");
return index.ToString();
}
}
}
Assign the source to a CollectionView
Expected Behavior
Only visible data items should be retrieved. ListView does this when defining an IReadOnlyList data source, although even that is a seemingly arbitrary distinction.
Description
CollectionView is being groomed as a replacement for ListView. However, due to a lack of real data virtualization it is not a viable option for many scenarios. While CollectionView does support "incremental data load", it is up to the consumer to swap new data in and is cumbersome to say the least. At a minimum, the eager loading of the entire data source is not expected behavior.
Steps to Reproduce
Define a data source:
Assign the source to a CollectionView
Expected Behavior
Only visible data items should be retrieved. ListView does this when defining an IReadOnlyList data source, although even that is a seemingly arbitrary distinction.
Actual Behavior
All items are retrieved.
Basic Information