2013-02-17 58 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事件。

相關問題