Virtualize<TItem>.ScrollToItemAsync(Int32, CancellationToken) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Scrolls the viewport so the item at itemIndex is aligned to the start of the visible area.
public System.Threading.Tasks.Task ScrollToItemAsync(int itemIndex, System.Threading.CancellationToken cancellationToken = default);
member this.ScrollToItemAsync : int * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function ScrollToItemAsync (itemIndex As Integer, Optional cancellationToken As CancellationToken = Nothing) As Task
Parameters
- itemIndex
- Int32
The zero-based index of the item to scroll to.
- cancellationToken
- CancellationToken
A token that lets the caller request cancellation.
Returns
A Task that completes when the target is aligned or superseded by another call,
or faults with OperationCanceledException if cancellationToken is cancelled.
Remarks
Each call cancels any previously-running ScrollToItemAsync(Int32, CancellationToken) (last call wins). Must be called on the renderer's synchronization context; background-thread callers should wrap with InvokeAsync(Func<Task>) to await completion.