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?

Best Answer

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.

  • keertanadaparikeertanadapari INMember ✭✭

    @RaphaelChiorlinRanieri
    Did you find solution to this?? If Yes, can you please tell me~~~~

  • RaphaelChiorlinRanieriRaphaelChiorlinRanieri BRMember ✭✭✭
    Accepted Answer

    @keertanadapari check this thread and this gitHub.
    They implemented the scrolled event in ListView, this way you can use the offset as seanyda said.

  • keertanadaparikeertanadapari INMember ✭✭
Sign In or Register to comment.