Skip to content

Instantly share code, notes, and snippets.

@nodoid
Created October 1, 2017 17:23
Show Gist options
  • Save nodoid/f813a5dd150b3d05f9a9f833501b76f7 to your computer and use it in GitHub Desktop.
Save nodoid/f813a5dd150b3d05f9a9f833501b76f7 to your computer and use it in GitHub Desktop.
async Task Scroller(StackLayout layout, ScrollView scroll, int position)
{
await Task.Delay(layout.Children.Count * 10).ContinueWith((y) =>
{
if (y.IsCompleted)
{
var selected = layout.Children[position];
Device.BeginInvokeOnMainThread(async () => await scroll.ScrollToAsync((StackLayout)selected, ScrollToPosition.Center, true));
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment