@@ -56,15 +56,15 @@ public static async Task SmoothScrollIntoViewWithIndexAsync(this ListViewBase li
56
56
previousXOffset = scrollViewer . HorizontalOffset ;
57
57
previousYOffset = scrollViewer . VerticalOffset ;
58
58
59
- var tcs = new TaskCompletionSource < VoidResult > ( ) ;
59
+ var tcs = new TaskCompletionSource < object > ( ) ;
60
60
61
- void ViewChanged ( object obj , ScrollViewerViewChangedEventArgs args ) => tcs . TrySetResult ( result : default ) ;
61
+ void ViewChanged ( object _ , ScrollViewerViewChangedEventArgs __ ) => tcs . TrySetResult ( result : default ) ;
62
62
63
63
try
64
64
{
65
65
scrollViewer . ViewChanged += ViewChanged ;
66
66
listViewBase . ScrollIntoView ( listViewBase . Items [ index ] , ScrollIntoViewAlignment . Leading ) ;
67
- await tcs . Task . ConfigureAwait ( true ) ;
67
+ await tcs . Task ;
68
68
}
69
69
finally
70
70
{
@@ -80,7 +80,7 @@ public static async Task SmoothScrollIntoViewWithIndexAsync(this ListViewBase li
80
80
// Scrolling back to previous position
81
81
if ( isVirtualizing )
82
82
{
83
- await scrollViewer . ChangeViewAsync ( previousXOffset , previousYOffset , zoomFactor : null , disableAnimation : true ) . ConfigureAwait ( true ) ;
83
+ await scrollViewer . ChangeViewAsync ( previousXOffset , previousYOffset , zoomFactor : null , disableAnimation : true ) ;
84
84
}
85
85
86
86
var listViewBaseWidth = listViewBase . ActualWidth ;
@@ -172,7 +172,7 @@ public static async Task SmoothScrollIntoViewWithIndexAsync(this ListViewBase li
172
172
}
173
173
}
174
174
175
- await scrollViewer . ChangeViewAsync ( finalXPosition , finalYPosition , zoomFactor : null , disableAnimation ) . ConfigureAwait ( true ) ;
175
+ await scrollViewer . ChangeViewAsync ( finalXPosition , finalYPosition , zoomFactor : null , disableAnimation ) ;
176
176
}
177
177
178
178
/// <summary>
@@ -188,7 +188,7 @@ public static async Task SmoothScrollIntoViewWithIndexAsync(this ListViewBase li
188
188
/// <returns>Returns <see cref="Task"/> that completes after scrolling</returns>
189
189
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 )
190
190
{
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 ) ;
192
192
}
193
193
194
194
/// <summary>
@@ -201,7 +201,7 @@ public static async Task SmoothScrollIntoViewWithItemAsync(this ListViewBase lis
201
201
/// <param name="disableAnimation">if set to <c>true</c> disable animation.</param>
202
202
private static async Task ChangeViewAsync ( this ScrollViewer scrollViewer , double ? horizontalOffset , double ? verticalOffset , float ? zoomFactor , bool disableAnimation )
203
203
{
204
- var tcs = new TaskCompletionSource < VoidResult > ( ) ;
204
+ var tcs = new TaskCompletionSource < object > ( ) ;
205
205
206
206
void ViewChanged ( object _ , ScrollViewerViewChangedEventArgs e )
207
207
{
@@ -217,20 +217,12 @@ void ViewChanged(object _, ScrollViewerViewChangedEventArgs e)
217
217
{
218
218
scrollViewer . ViewChanged += ViewChanged ;
219
219
scrollViewer . ChangeView ( horizontalOffset , verticalOffset , zoomFactor , disableAnimation ) ;
220
- await tcs . Task . ConfigureAwait ( true ) ;
220
+ await tcs . Task ;
221
221
}
222
222
finally
223
223
{
224
224
scrollViewer . ViewChanged -= ViewChanged ;
225
225
}
226
226
}
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
- }
235
227
}
236
228
}
0 commit comments