Browse Source

Merge pull request #4452 from AvaloniaUI/fixes/4330-itemsrepeater-no-scrollviewer

Make ItemsRepeater work with no ScrollViewer.
pull/4478/head
danwalmsley 6 years ago
committed by GitHub
parent
commit
c9b62df93c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      src/Avalonia.Controls/Repeater/ViewportManager.cs

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

@ -350,11 +350,14 @@ namespace Avalonia.Controls
}
// Make sure that only the target child can be the anchor during the bring into view operation.
foreach (var child in _owner.Children)
if (_scroller is object)
{
if (child != targetChild)
foreach (var child in _owner.Children)
{
_scroller.UnregisterAnchorCandidate(child);
if (child != targetChild)
{
_scroller.UnregisterAnchorCandidate(child);
}
}
}
@ -469,13 +472,7 @@ namespace Avalonia.Controls
parent = parent.VisualParent;
}
if (_scroller == null)
{
// We usually update the viewport in the post arrange handler. But, since we don't have
// a scroller, let's do it now.
UpdateViewport(Rect.Empty);
}
else if (!_managingViewportDisabled)
if (!_managingViewportDisabled)
{
_owner.EffectiveViewportChanged += OnEffectiveViewportChanged;
_effectiveViewportChangedSubscribed = true;

Loading…
Cancel
Save