Skip to content

Commit 3945999

Browse files
committed
Fixed issue where SmoothScrollIntoView doesn't await until the animation completes
1 parent 4590172 commit 3945999

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,15 @@ private static async Task ChangeViewAsync(this ScrollViewer scrollViewer, double
203203
{
204204
var tcs = new TaskCompletionSource<VoidResult>();
205205

206-
void ViewChanged(object _, ScrollViewerViewChangedEventArgs __) => tcs.TrySetResult(result: default);
206+
void ViewChanged(object _, ScrollViewerViewChangedEventArgs e)
207+
{
208+
if (e.IsIntermediate)
209+
{
210+
return;
211+
}
212+
213+
tcs.TrySetResult(result: default);
214+
}
207215

208216
try
209217
{

0 commit comments

Comments
 (0)