Xamarin Forms (Portable) keeping the currently selected textbox in focus when keyboard pops up

844 Views Asked by At

I am using a ContentPage in a Xamarin.Forms project in Visual Studio 2015 with C# where I have a few text input boxes postioned at the bottom of the screen. I want that the screen reposition itself to show in view the current textbox which has the cursor when the onscreen keypad pops up. When the user cancels the keypad the form should expand back into its original position before the keypad popped up. I am using this link to figure this out, but it is not working. The keypad still covers the textbox. Here is the Xaml of the screen.

  <ContentPage>
      <ContentPage.Padding>
          <OnPlatform x:TypeArguments="Thickness">
              <OnPlatform.WinPhone>0, 20, 0, 0</OnPlatform.WinPhone>
          </OnPlatform>
      </ContentPage.Padding>   

    <ContentPage.Content>
      <ScrollView >

        <StackLayout >
            <BoxView BackgroundColor="Red" HeightRequest="162" WidthRequest="150" />
            <Entry Placeholder="Username" Text="{Binding UserName}"></Entry> 
            <Entry Placeholder="Password" IsPassword="True" Text="{Binding Pass}"></Entry> 

            <Button Text="Login" Command="{Binding onClicked}" />

        </StackLayout>
      </ScrollView>
    </ContentPage.Content>

  </ContentPage>  

Is there something that I might have missed in that article?

EDIT: Adding Screenshot

enter image description here

0

There are 0 best solutions below