Windows phone keyboard open events and properties

烈酒焚心 提交于 2019-12-19 10:44:24

问题


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)?


回答1:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!