Search code examples
xamarinxamarin.formskeyboardscrollview

Enable scroll on page when keyboard is displayed


My page looks like this:

enter image description here

If the user focus one of the entries, page is "locked". The user can't move up or down as it follows:

enter image description here

I've used ContentPage with ScrollView as a main layout. I've also tried to set Window.SetSoftInputMode() in various modes, but everything remains the same.

Is there any modular way to fix this (I have workaround with a StackLayout above entries with HeightRequest=0, when one of the entries is focused, I change HeightRequest to the height of keyboard) ?


Solution

  • You can also manually scroll your page using below code

    void EntryKeyboardHandle_Focused(object sender, Xamarin.Forms.FocusEventArgs e)
            {
                Device.BeginInvokeOnMainThread(async () =>
                {
                    var height = SignupGrid.Height;
                    await MainScroll.ScrollToAsync(0, height, true);
                });
            }
    

    You need to put your grid or stacklayout in scroll view and put focus event on entry.

    Focused="EntryKeyboardHandle_Focused"