diff --git a/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs b/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs index 378333e32c..228ad65ffa 100644 --- a/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs +++ b/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs @@ -519,9 +519,19 @@ namespace Avalonia.Controls.Presenters { layoutManager.ExecuteLayoutPass(); - if (!new Rect(panel.Bounds.Size).Contains(container.Bounds)) + if (panel.ScrollDirection == Orientation.Vertical) { - OffsetValue += 1; + if (container.Bounds.Y < panel.Bounds.Y || container.Bounds.Bottom > panel.Bounds.Bottom) + { + OffsetValue += 1; + } + } + else + { + if (container.Bounds.X < panel.Bounds.X || container.Bounds.Right > panel.Bounds.Right) + { + OffsetValue += 1; + } } }