private void MyList_CacheVirtualItems(object sender, CacheVirtualItemsEventArgs e)
{
if (sender != this._curList)
return;
var listCache = this._listItemCache;
if (listCache?.TargetList == sender && listCache.IsSupersetOf(e.StartIndex, e.EndIndex))
{
// If the newly requested cache is a subset of the old cache,
// no need to rebuild everything, so do nothing.
return;
}
// Now we need to rebuild the cache.
this.CreateCache(e.StartIndex, e.EndIndex);
}