Browse Source

Register action on lower priority than render.

`OnEffectiveViewportChanged` needs to be triggered first, otherwise `_makeAnchorElement` is cleared too early, breaking scrolling in a list with variable-height items.
pull/4091/head
Steven Kirk 6 years ago
parent
commit
402e497fa8
  1. 6
      src/Avalonia.Controls/Repeater/ViewportManager.cs

6
src/Avalonia.Controls/Repeater/ViewportManager.cs

@ -346,10 +346,14 @@ namespace Avalonia.Controls
}
// Register action to go back to how things were before where any child can be the anchor.
// Register action to go back to how things were before where any child can be the anchor. Here,
// WinUI uses CompositionTarget.Rendering but we don't currently have that, so post an action to
// run *after* rendering has completed (priority needs to be lower than Render as Transformed
// bounds must have been set in order for OnEffectiveViewportChanged to trigger).
if (!_isBringIntoViewInProgress)
{
_isBringIntoViewInProgress = true;
Dispatcher.UIThread.Post(OnCompositionTargetRendering);
Dispatcher.UIThread.Post(OnCompositionTargetRendering, DispatcherPriority.Loaded);
}
}
}

Loading…
Cancel
Save