How to adjust screen when keyboard open in windows phone 8?

511 views Asked by At

I am working in Windows phone 8. In One of the pages of my app there is a LongListSelector and under it there is a TextBox. When the TextBox get focused then keyboard is opened. As the keyboard is opened then the LongListSelector is shifted up by keyboard height. If I maintain the margin of the LongListSelector by keyboard's offset then some of the items of LongListSelector go under the keyboard.

All I want to do is when keyboard is shown then margin will be updated and the previous focused item of the LongListSelector should not go under keyboard. Here I don't want to use ScrollTo() function to scroll a specific item of LongListSelector.

Any suggestion or help will be appreciated.

1

There are 1 answers

0
Nishi On

Here is an example of workaround. Though this code is for WP8. You will have to make some changes to make this working for WP8.1 like :

  1. Tap in xaml will be replaced by Tapped.
  2. ((App)Application.Current).RootFrame.RenderTransform = new CompositeTransform(); will be replaced by

    Window.Current.Content.RenderTransform = new CompositeTransform();

  3. Dispatcher.BeginInvoke(() => {}will be replaced by

CoreDispatcher dispatcher = CoreWindow.GetForCurrentThread().Dispatcher; await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {}

let me know if you face any issue.