c# - Windows Phone 键盘打开事件和属性

标签 c# xaml windows-phone-8.1 keyboard-events

在我的 Windows Phone 应用程序上,我需要相应地更改我的 View 以适应我的键盘。 我有几个问题:

如何识别键盘是否打开?是否有键盘打开的 View 事件?

有没有办法获取键盘的高度? 或者被屏蔽的 UI 的区域大小(通过键盘)?

最佳答案

您可以通过 Windows.UI.ViewManagement.InputPane 类访问键盘信息。有静态方法 GetForCurrentView()。它返回当前 View 的 InputPane。 InputPane 具有事件 HidingShowing 以及属性 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/

相关文章:

c# - 添加 IdentityUser 作为其他模型的属性

c# - 在 WPF Tabcontrol header 模板中显示 SelectedIndex

c# - 如何以编程方式更改 Win 8.1 或 Win 10 UWP 应用程序的背景主题?

c# - 水平堆栈面板上 ListItem 之间的间距

c# - 在 C# 中使用 xmlnamespacemanager 添加命名空间

c# - Winforms TabControl 对齐问题

wpf - 使用代码隐藏从 XAML 访问变量和从 ViewModel 访问对象

c++ - Windows 手机 C++

C# 正则表达式匹配有或没有新行

wpf - 设置 WPF/XAML 窗口客户区大小