Popup windows doesn#39;t move up when Surface keyboard is shown in Windows 8 store app(当 Surface 键盘显示在 Windows 8 商店应用程序中时,弹出窗口不会向上移动)
问题描述
我有一个 Windows 商店应用程序,它要求用户通过大量文本框输入数据.
I have a windows store application that requires the users to enter data via numerous textboxes.
当屏幕底部附近的文本框获得焦点时,屏幕键盘会出现并将页面内容向上移动.这很棒,也是我想要的.
When a textbox near the bottom of the screen has focus the on screen keyboard appears and moves the content of the page up. This is great and what I want.
当我有一个弹出窗口时会出现我的问题.当我的弹出窗口出现时,它实际上是全屏的.弹出窗口的子窗口是一个用户控件,上面有很多文本框.When one of the textboxes near the bottom of the page is selected, the keyboard appears but the screen doesn't move up so the keyboard is appearing over the selected textbox.
My problem occurs when I have a popup window. When my popup window appears it is practically full screen. The popup window's child is a user control which again has lots of textboxes on it. When one of the textboxes near the bottom of the page is selected, the keyboard appears but the screen doesn't move up so the keyboard is appearing over the selected textbox.
这是我用来显示弹出窗口的代码:
This is the code I use to display my popup:
if (myPopup == null)
{
myPopup = new Popup();
myPopup.Child = new PopupFrom();
// open the Popup
myPopup.IsOpen = true;
}
我还在布局更新时手动调整弹出窗口的大小
I also manually size the popup when the layout is updated
private void popup_LayoutUpdated(object sender, object e)
{
if (Windows.UI.ViewManagement.ApplicationView.Value == Windows.UI.ViewManagement.ApplicationViewState.FullScreenLandscape)
{
popup.Width = 1280;
popup.Height = 680;
}
else
{
popup.Width = 680;
popup.Height = 1280;
}
}
所以我的问题是,当键盘显示并与弹出窗口底部附近的一个文本框重叠时,如何向上移动弹出窗口?
So my question is how can I move the popup window up when the keyboard is shown and overlapping one of the textboxes near the bottom of the popup?
提前致谢.
我正在使用 C# &XAML 来编写这个 windows 8 商店应用程序.
I'm using C# & XAML to write this windows 8 store app.
推荐答案
在我的应用程序中,我听 InputPane 显示/隐藏事件.这些事件告诉您键盘或其他输入设备何时显示/隐藏:
In my app, I listen to the InputPane show/ hide events. These events tell you when the keyboard or other input device is shown/ hidden:
var pane = InputPane.GetForCurrentView();
pane.Showing += pane_Showing;
pane.Hiding += pane_Hiding;
在您的事件处理程序中,您可以使用 OccludedRect
属性来确定输入区域(例如键盘)有多大.然后你可以移动你的弹出窗口,使它不覆盖这个矩形.
In your event handlers, you can use the OccludedRect
property to determine how big the input area (e.g. keyboard) is. Then you can shift your popup so that it does not cover this rectangle.
这篇关于当 Surface 键盘显示在 Windows 8 商店应用程序中时,弹出窗口不会向上移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:当 Surface 键盘显示在 Windows 8 商店应用程序中时,弹出窗口不会向上移动
基础教程推荐
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- SSE 浮点算术是否可重现? 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01