Browse Source

Quick fix for scroll to end with virtualized items.

As described in #2144, scrolling to the end of a list of virtualized items with differing heights doesn't always work correctly. This is a quick hack to try to fix that.
pull/2591/head
Steven Kirk 7 years ago
parent
commit
dd9839461a
  1. 9
      src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs

9
src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs

@ -20,6 +20,8 @@ namespace Avalonia.Controls.Presenters
/// </summary>
internal class ItemVirtualizerSimple : ItemVirtualizer
{
private int _anchor;
/// <summary>
/// Initializes a new instance of the <see cref="ItemVirtualizerSimple"/> class.
/// </summary>
@ -362,7 +364,10 @@ namespace Avalonia.Controls.Presenters
if (panel.OverflowCount > 0)
{
RemoveContainers(panel.OverflowCount);
if (_anchor <= FirstIndex)
{
RemoveContainers(panel.OverflowCount);
}
}
}
@ -540,7 +545,9 @@ namespace Avalonia.Controls.Presenters
// it means we're running a unit test.
if (container != null && layoutManager != null)
{
_anchor = index;
layoutManager.ExecuteLayoutPass();
_anchor = -1;
if (newOffset != -1 && newOffset != OffsetValue)
{

Loading…
Cancel
Save