2013-02-17 52 views
3

我试图在我的WP8应用程序中打开软件键盘时做一些智能调整XAML元素的大小,并且出于某种原因,InputPane.Showing/Hiding事件永远不会被调用。在我的OnNavigatedTo覆盖,我有以下几点:InputPane.Showing/Hiding从未调用过

InputPane inputPane = InputPane.GetForCurrentView(); 
inputPane.Showing += (InputPane sender, InputPaneVisibilityEventArgs args) => 
{ 
    outputTextScroller.Height -= args.OccludedRect.Height; 
}; 

inputPane.Hiding += (InputPane sender, InputPaneVisibilityEventArgs args) => 
{ 
    outputTextScroller.Height += args.OccludedRect.Height; 
}; 

把断点到lambda表达式,我发现代码永远不会获取调用。没有例外被抛出,并且应用程序中没有其他东西似乎有故障。有谁知道为什么这些事件不会被触发?当我点击一个文本框进行数据输入时,或者点击一个TextBlock,然后将该文本框的焦点放在该数据项上,输入窗格就会打开。

+0

你找到如何让键盘高度的任何解决方案? – Alex 2015-10-06 12:15:56

回答

1

InputPane的文档声明它仅支持“仅适用于本机应用程序”。为了确定何时显示虚拟键盘,您需要处理GotFocusLostFocus事件。

相关问题