public void CleanUpFilledCacheNormalCase() { var target = new SizesCache(); target.AddOrChange(0, 40); target.AddOrChange(0, 41); target.AddOrChange(0, 42); target.AddOrChange(0, 43); target.CleanUp(0); Assert.AreEqual(0, target.GetEstimate(0)); }
/// <summary> /// Revirtualize items that are no longer visible /// </summary> /// <param name="minDesiredGenerated">first item index that should be visible</param> /// <param name="maxDesiredGenerated">last item index that should be visible</param> private void CleanUpItems(int minDesiredGenerated, int maxDesiredGenerated) { var children = InternalChildren; var generator = ItemContainerGenerator; for (var i = children.Count - 1; i >= 0; i--) { var childGeneratorPos = new GeneratorPosition(i, 0); var itemIndex = generator.IndexFromGeneratorPosition(childGeneratorPos); if (itemIndex < minDesiredGenerated || itemIndex > maxDesiredGenerated) { generator.Remove(childGeneratorPos, 1); RemoveInternalChildRange(i, 1); } } cachedSizes.CleanUp(maxDesiredGenerated); }
/// <summary> /// Revirtualize items that are no longer visible /// </summary> /// <param name="minDesiredGenerated">first item index that should be visible</param> /// <param name="maxDesiredGenerated">last item index that should be visible</param> private void CleanUpItems(int minDesiredGenerated, int maxDesiredGenerated) { UIElementCollection children = this.InternalChildren; IItemContainerGenerator generator = this.ItemContainerGenerator; for (int i = children.Count - 1; i >= 0; i--) { GeneratorPosition childGeneratorPos = new GeneratorPosition(i, 0); int itemIndex = generator.IndexFromGeneratorPosition(childGeneratorPos); if (itemIndex < minDesiredGenerated || itemIndex > maxDesiredGenerated) { generator.Remove(childGeneratorPos, 1); RemoveInternalChildRange(i, 1); } } cachedSizes.CleanUp(maxDesiredGenerated); }