internal void CorrectSlotsAfterInsertion(int slot, UIElement element, bool isCollapsed) { if (slot < this.FirstScrollingSlot) { // The row was inserted above our viewport, just update our indexes this.FirstScrollingSlot++; this.LastScrollingSlot++; } else if (isCollapsed && (slot <= this.LastScrollingSlot)) { this.LastScrollingSlot++; } else if ((_owner.GetPreviousVisibleSlot(slot) <= this.LastScrollingSlot) || (this.LastScrollingSlot == -1)) { Debug.Assert(element != null); // The row was inserted in our viewport, add it as a scrolling row LoadScrollingSlot(slot, element, true /*updateSlotInformation*/); } }