@@ -56,15 +56,15 @@ public static async Task SmoothScrollIntoViewWithIndexAsync(this ListViewBase li
5656 previousXOffset = scrollViewer . HorizontalOffset ;
5757 previousYOffset = scrollViewer . VerticalOffset ;
5858
59- var tcs = new TaskCompletionSource < VoidResult > ( ) ;
59+ var tcs = new TaskCompletionSource < object > ( ) ;
6060
61- void ViewChanged ( object obj , ScrollViewerViewChangedEventArgs args ) => tcs . TrySetResult ( result : default ) ;
61+ void ViewChanged ( object _ , ScrollViewerViewChangedEventArgs __ ) => tcs . TrySetResult ( result : default ) ;
6262
6363 try
6464 {
6565 scrollViewer . ViewChanged += ViewChanged ;
6666 listViewBase . ScrollIntoView ( listViewBase . Items [ index ] , ScrollIntoViewAlignment . Leading ) ;
67- await tcs . Task . ConfigureAwait ( true ) ;
67+ await tcs . Task ;
6868 }
6969 finally
7070 {
@@ -80,7 +80,7 @@ public static async Task SmoothScrollIntoViewWithIndexAsync(this ListViewBase li
8080 // Scrolling back to previous position
8181 if ( isVirtualizing )
8282 {
83- await scrollViewer . ChangeViewAsync ( previousXOffset , previousYOffset , zoomFactor : null , disableAnimation : true ) . ConfigureAwait ( true ) ;
83+ await scrollViewer . ChangeViewAsync ( previousXOffset , previousYOffset , zoomFactor : null , disableAnimation : true ) ;
8484 }
8585
8686 var listViewBaseWidth = listViewBase . ActualWidth ;
@@ -172,7 +172,7 @@ public static async Task SmoothScrollIntoViewWithIndexAsync(this ListViewBase li
172172 }
173173 }
174174
175- await scrollViewer . ChangeViewAsync ( finalXPosition , finalYPosition , zoomFactor : null , disableAnimation ) . ConfigureAwait ( true ) ;
175+ await scrollViewer . ChangeViewAsync ( finalXPosition , finalYPosition , zoomFactor : null , disableAnimation ) ;
176176 }
177177
178178 /// <summary>
@@ -188,7 +188,7 @@ public static async Task SmoothScrollIntoViewWithIndexAsync(this ListViewBase li
188188 /// <returns>Returns <see cref="Task"/> that completes after scrolling</returns>
189189 public static async Task SmoothScrollIntoViewWithItemAsync ( this ListViewBase listViewBase , object item , ScrollItemPlacement itemPlacement = ScrollItemPlacement . Default , bool disableAnimation = false , bool scrollIfVisibile = true , int additionalHorizontalOffset = 0 , int additionalVerticalOffset = 0 )
190190 {
191- await SmoothScrollIntoViewWithIndexAsync ( listViewBase , listViewBase . Items . IndexOf ( item ) , itemPlacement , disableAnimation , scrollIfVisibile , additionalHorizontalOffset , additionalVerticalOffset ) . ConfigureAwait ( true ) ;
191+ await SmoothScrollIntoViewWithIndexAsync ( listViewBase , listViewBase . Items . IndexOf ( item ) , itemPlacement , disableAnimation , scrollIfVisibile , additionalHorizontalOffset , additionalVerticalOffset ) ;
192192 }
193193
194194 /// <summary>
@@ -201,7 +201,7 @@ 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- var tcs = new TaskCompletionSource < VoidResult > ( ) ;
204+ var tcs = new TaskCompletionSource < object > ( ) ;
205205
206206 void ViewChanged ( object _ , ScrollViewerViewChangedEventArgs e )
207207 {
@@ -217,20 +217,12 @@ void ViewChanged(object _, ScrollViewerViewChangedEventArgs e)
217217 {
218218 scrollViewer . ViewChanged += ViewChanged ;
219219 scrollViewer . ChangeView ( horizontalOffset , verticalOffset , zoomFactor , disableAnimation ) ;
220- await tcs . Task . ConfigureAwait ( true ) ;
220+ await tcs . Task ;
221221 }
222222 finally
223223 {
224224 scrollViewer . ViewChanged -= ViewChanged ;
225225 }
226226 }
227-
228- /// <summary>
229- /// Used as a placeholder TResult to indicate that a <![CDATA[Task<TResult>]]> has a void TResult
230- /// </summary>
231- /// <see href="https://referencesource.microsoft.com/#System.Core/System/Threading/Tasks/TaskExtensions.cs,6e36a68760fb02e6,references"/>
232- private struct VoidResult
233- {
234- }
235227 }
236228}
0 commit comments