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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
7 additions and
10 deletions
-
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; |
|
|
|
|