问题描述
我们开始在 Windows 8 中创建 WPF 触摸应用程序,最近迁移到 Windows 10.我们实现的一项功能是在 TextBox
获得焦点时打开 Windows 键盘.在 Windows 8 中,可以通过设置注册表设置 EdgeTargetDockedState
并启动 TabTip 进程来将键盘停靠在底部:
We started creating a WPF touch application in Windows 8 and recently migrated to Windows 10. One feature we implemented is opening the Windows Keyboard when a TextBox
receives focus. In Windows 8, it was possible to dock the keyboard to the bottom by setting the registry setting EdgeTargetDockedState
and starting the TabTip process:
string path = @"C:Program FilesCommon FilesMicrosoft SharedinkTabTip.exe";
var info = new ProcessStartInfo(path);
info.WindowStyle = ProcessWindowStyle.Maximized;
var p = new Process();
p.StartInfo = info;
p.Start();
但是,Windows 10 键盘似乎与 Windows 8 中的停靠行为不同.键盘现在覆盖任何最大化的窗口,该窗口隐藏了任何应用程序的底部.只有未最大化的窗口会调整大小以适应剩余空间.
The Windows 10 keyboard however doesn't seem to have the same dock behavior as in Windows 8. The keyboard now overlays any maximized window which hides the bottom part of any application. Only not-maximized windows are resized to fit the remaining space.
我检查了以下链接,但没有找到解决方案:
I've checked the following links, but found no solution:
- https://superuser.com/questions/951841/windows-10-touch-keyboard-doesnt-dock-or-maximize-at-the-bottom-of-the-screen
- http://answers.microsoft.com/en-us/windows/forum/windows_10-desktop/windows-10-touch-keyboard-doesnt-dock/3c253400-568f-4e89-a253-0d7a747b5b63
能否以编程方式停靠 Windows 10 键盘以实现最大化窗口?
Can the Windows 10 keyboard be docked programmatically for a maximized window?
推荐答案
我开源了我的项目以自动化所有与 WPF 应用程序中的 TabTip 集成有关的事情.
I open-sourced my project to automate everything concerning TabTip integration in WPF app.
您可以在 nuget 上获得它,然后您只需要一个简单的配置在您的应用启动逻辑中:
You can get it on nuget, and after that all you need is a simple config in your apps startup logic:
TabTipAutomation.BindTo<TextBox>();
您可以将 TabTip 自动化逻辑绑定到任何 UIElement.虚拟键盘将在任何此类元素获得焦点时打开,并在元素失去焦点时关闭.不仅如此,TabTipAutomation 还会将 UIElement(或 Window)移动到视图中,这样 TabTip 就不会阻塞焦点元素.
You can bind TabTip automation logic to any UIElement. Virtual Keyboard will open when any such element will get focus, and it will close when element will lose focus. Not only that, but TabTipAutomation will move UIElement (or Window) into view, so that TabTip will not block focused element.
有关详细信息,请参阅项目网站.
For more info refer to the project site.
澄清一下:如果你将使用这个包,TabTip 将不会被停靠,但你的 UI 会在视图中,我想这就是你想要实现的.
To clarify: If you will be using this package TabTip will not be docked, but your UI will be in view, which i guess is what you wanted to achieve.
这篇关于打开停靠在 WPF 中的 Windows 10 触摸键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!