On my Windows Phone app I need to change my view accordingly to my keyboard. I have several questions:
How can I identify that the keyboard is opened? Is there an event on view for keyboard opening?
Is there a way to get the height of the keyboard? Or the area size of the blocked UI (by keyboard)?
You can access to keyboard information by Windows.UI.ViewManagement.InputPane
class. There is static method GetForCurrentView()
. It returns InputPane for current view. InputPane has events Hiding
and Showing
and property OccludedRect
which returns region that input pane is covering.
InputPane inputPane = InputPane.GetForCurrentView();
inputPane.Showing += OnInputPaneShowing;
inputPane.Hiding += OnInputPaneHiding;
Rect coveredArea = inputPane.OccludedRect;
来源:https://stackoverflow.com/questions/33984936/windows-phone-keyboard-open-events-and-properties