Hide StackLayout On Scroll

Hey,

I need to implement a Stack Layout that hide when scrolling down in a listView and appear when scrolling up...

It is not the Nav Bar, it would be a normal stack Layout.

Any hints on how to do that?
Someone have already tried it?

Answers

  • seanydaseanyda GBMember ✭✭✭✭✭

    The ScrollView control has the Scrolled event and using the data from the EventArgs you will be able to tell whether the ScrollView has scrolled up or down.

     ScrollView sv = new ScrollView();
                sv.Scrolled += (sender, e) => {
                    double ScrollY = e.ScrollY;
                    double ScrollX = e.ScrollX;
                };
    

    You can store the previous ScrollY position in a variable and compare it to the recent "ScrollY" variable and tell whether it's scrolled up or down. You can then use that information to create an if statement on hiding the StackLayout with the IsVisible property.

Sign In or Register to comment.