Can
Can

Reputation: 377

XAML TextBox inside Popup gets hidden by on screen keyboard

In my metro application, I have a page full of TextBoxes that are laid out vertically inside a StackPanel. Normally, when the user clicks one of the bottom textboxes, the page automatically scrolls upwards so that the focused textbox is not obscured by the on screen keyboard.

But this automatic scrolling doesn't seem to happen if the page is displayed inside a Popup. What should I do to make my Popups have the same scrolling behavior as normal pages?

Upvotes: 1

Views: 776

Answers (1)

Patrick Finnigan
Patrick Finnigan

Reputation: 1957

You're right, Popups don't automatically scroll when the input pane appears because Popups are outside of the root scroll viewer in the main visual tree.

It sounds like you have rather complex UI within your Popup. You might want to consider whether you can rework this UI outside the context of a Popup in a metro-friendly way.

If you want to try to reposition popups when the input pane shows, you should be able to hook into the InputPane.Showing event. You would have to do the calculations yourself and to reset the original offset when the InputPane hides.

http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.viewmanagement.inputpane.showing.aspx

Upvotes: 1

Related Questions