I have a simple screen example trying to implement the ScrollToAsync function. I can't get the function to scroll at all.
My XAML:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MyApp.ItemList">
<ContentPage.Content>
<ScrollView x:Name="myScroll">
<StackLayout>
<Label Text="Welcome to Xamarin.Forms!" />
<Label Text="Welcome to Xamarin.Forms!" />
<Label Text="Welcome to Xamarin.Forms!" />
<Label Text="Welcome to Xamarin.Forms!" />
// Many labels to fill space here
<Label Text="Welcome to Xamarin.Forms!" />
</StackLayout>
</ScrollView>
</ContentPage.Content>
</ContentPage>
And the C# is:
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ItemList : ContentPage
{
public ItemList ()
{
InitializeComponent ();
myScroll.ScrollToAsync(0, 100, false);
}
}
What am I doing wrong? It must be something simple I need to do. I already tried wrapping the ScrollToAsync call in an async method, so I can use "await" before it, but this did not work.