Forum Xamarin.Forms

How to Scroll the screen upto last entry in Xamarin Forms?

I am doing an app in which i have to submit data having 8 entries one by one in a stack. I used the scrollview.But when the user clicks on first entry the keypad will appear and screen scrolls.Then the user can see the second entry and fill the data.

But after coming to fourth entry or fifth entry the scrolls gets stopped.As a result the user cannot see the the next entry without closing the keypad.

Can anyone give a solution to my problem.I tried adding the scrollview to the entire screen also.

Thanks in Advance.


  • JohnHardmanJohnHardman GBUniversity admin

    @Praveen.B - is this a problem just on Android, or across platforms? If just on Android, and you're feeling brave, you could update your Xamarin.Forms version to 2.4.0 (which was released yesterday). According to the release notes, there is a bug fix that might change what you are seeing.

    If it's a cross-platform problem, you can add a Completed handler to each Entry, with the handler explicitly moving the focus to the next Entry and explicitly scrolling your ScrollView. However, note that there are still outstanding XF bugs that affect this.

  • Praveen.BPraveen.B INMember ✭✭
    edited September 2017

    Thanks for your response JohnHardman.It is a cross paltform application and also I used this code

    private void OnLabelFocsed(object sender, Xamarin.Forms.FocusEventArgs e)

    When i use this code the street label is going to top of the screen but the last two entries are not scrollable.

  • JohnHardmanJohnHardman GBUniversity admin

    @Praveen.B -

    Not all types of View can receive focus. What View have you hooked OnLabelFocsed to?

    ScrollToAsync is an async method. You will normally want to await it.

    As per previous post, "is this a problem just on Android, or across platforms?"

  • N_BauaN_Baua INMember ✭✭✭✭✭

    Hi @Praveen.B,

    Let your scrollview have some bottom Padding and also set VerticalOptions="FillAndExpand", Hope it helps.

    Also a renderer like this might also help you a bit.

    -- N Baua

  • Praveen.BPraveen.B INMember ✭✭
    edited October 2017

    Hi @JohnHardman .The problem is only with android and in iOS it is working good.

    I updated the Xamarin.Forms package to 2.4.0 latest one.But the issue doesn't solved.

    Please give me some suggestions to clear that issue.

    Thank you.

  • JohnHardmanJohnHardman GBUniversity admin

    @Praveen.B - What is the type of ScrollStack in your code above?

    Also, can you post the XAML / code that shows the structure of the page where this is happening.

  • Praveen.BPraveen.B INMember ✭✭
    edited October 2017

    Hi @JohnHardman .The following is the structure of my code

    <Grid> <ScrollView IsVisible="True"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <StackLayout> <Label/> </StackLayout> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <Entry/> <Entry/> <Entry/> <Entry/> <Entry/> <Label/> <Entry/> <Button/> </Grid> </Grid> </ScrollView> <Grid IsVisible="False"> </Grid> </Grid>

    please guide me if i am going wrong in design.

    Thank you.

  • JohnHardmanJohnHardman GBUniversity admin

    @Praveen.B -

    Regarding your XAML - I know I used the word structure - that wasn't meant to mean strip out everything other than the tags. With just the tags, I cannot reliably match up your XAML to your previous comments. However, making some assumptions, I would say that you should not be explicitly scrolling the the Label, if you want the Entry and Button that follow to be visible. Instead scroll to the last thing you want to be visible (or even the element that immediately follows the last thing you want to be visible) . Also, making another assumption, move your ScrollView to be the outermost element.

    If it's still not working after making those changes, check the following links - I make use of the code from both of these, but I haven't moved to XF 2.4.0 yet, so whether they are still required in 2.4.0 I do not know.

Sign In or Register to comment.