在我的 Windows Phone 应用程序上,我需要相应地更改我的 View 以适应我的键盘。 我有几个问题:
如何识别键盘是否打开?是否有键盘打开的 View 事件?
有没有办法获取键盘的高度? 或者被屏蔽的 UI 的区域大小(通过键盘)?
最佳答案
您可以通过 Windows.UI.ViewManagement.InputPane
类访问键盘信息。有静态方法 GetForCurrentView()
。它返回当前 View 的 InputPane。 InputPane 具有事件 Hiding
和 Showing
以及属性 OccludedRect
返回输入 Pane 覆盖的区域。
InputPane inputPane = InputPane.GetForCurrentView();
inputPane.Showing += OnInputPaneShowing;
inputPane.Hiding += OnInputPaneHiding;
Rect coveredArea = inputPane.OccludedRect;
关于c# - Windows Phone 键盘打开事件和属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33984936/