Browse Source

Fix quick scrolling.

With a bit of a hack...
pull/2603/head
Steven Kirk 7 years ago
parent
commit
4850571a90
  1. 9
      src/Avalonia.Controls/Repeaters/ViewportManager.cs

9
src/Avalonia.Controls/Repeaters/ViewportManager.cs

@ -188,7 +188,16 @@ namespace Avalonia.Controls.Repeaters
if (!_managingViewportDisabled)
{
// HACK: This is a bit of a hack. We need the effective viewport of the ItemsRepeater -
// we can get this from TransformedBounds, but this property is updated after layout has
// run, resulting in the UI being updated too late when scrolling quickly. We can
// partially remedey this by triggering also on Bounds changes, but this won't work so
// well for nested ItemsRepeaters.
//
// UWP uses the EffectiveBoundsChanged event (which I think was implemented specially
// for this case): we need to implement that in Avalonia.
_effectiveViewportChangedRevoker = _owner.GetObservable(Visual.TransformedBoundsProperty)
.Merge(_owner.GetObservable(Visual.BoundsProperty).Select(_ => _owner.TransformedBounds))
.Skip(1)
.Subscribe(OnEffectiveViewportChanged);
}

Loading…
Cancel
Save