Skip to content

Commit 4b70980

Browse files
committed
Fixed Task not completing issue
1 parent a09e203 commit 4b70980

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Microsoft.Toolkit.Uwp.UI/Extensions/ListViewBase/ListViewExtensions.SmoothScrollIntoView.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ public static async Task SmoothScrollIntoViewWithItemAsync(this ListViewBase lis
201201
/// <param name="disableAnimation">if set to <c>true</c> disable animation.</param>
202202
private static async Task ChangeViewAsync(this ScrollViewer scrollViewer, double? horizontalOffset, double? verticalOffset, float? zoomFactor, bool disableAnimation)
203203
{
204+
horizontalOffset = horizontalOffset > scrollViewer.ScrollableWidth ? scrollViewer.ScrollableWidth : horizontalOffset;
205+
verticalOffset = verticalOffset > scrollViewer.ScrollableHeight ? scrollViewer.ScrollableHeight : verticalOffset;
206+
204207
// MUST check this and return immediately, otherwise this async task will never complete because ViewChanged event won't get triggered
205208
if (horizontalOffset == scrollViewer.HorizontalOffset && verticalOffset == scrollViewer.VerticalOffset)
206209
{

0 commit comments

Comments
 (0)