I have a scrollview which, as soon as the user starts to scroll up, I run some code (OnSwipeUp()). I detect this using
textScroll.Scrolled += (sender, e) => { onScrolled(); };
private void onScrolled()
{
if(textScroll.ScrollY > 0)
{
OnSwipeUp(null, null);
}
}
I also need to detect when the user start scrolling down, so I was thinking of getting the max Y position of the scrollview then say something like
if(textScroll.ScrollY < maxY)
Am I able to do this?
Try this:
private double previousScrollPosition = 0;
void Handle_Scrolled(object sender, Xamarin.Forms.ScrolledEventArgs e)
{
if (previousScrollPosition < e.ScrollY)
{
//scrolled down
previousScrollPosition = e.ScrollY;
}
else
{
//scrolled up
if (Convert.ToInt16(e.ScrollY) == 0)
previousScrollPosition = 0;
}
}