當我嘗試從使用手寫的畫布在文本框中添加文本時,光標移至文本框並顯示鍵盤,並嘗試添加一些代碼,如使文本框isReadonly或嘗試隱藏鍵盤並不起作用。 我希望每次都從列表框中選擇一個項目,將項目添加到文本框中而不顯示鍵盤。一個ListBox隱藏鍵盤Windows Phone 8.1
private void RecognizedListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (RecognizedListBox.SelectedItem == null)
return;
//gte the selected item from listbox
string inputTextWritePad = RecognizedListBox.SelectedItem.ToString();
//add the item to RichEditBox
MyTextNote.Text += inputTextWritePad + " ";
//clear the canvas return the listbox to vide
ClearAllClick(sender, e);
}
如果我添加isReadonly的文本框上RecognizedListBox_SelectionChanged的動作,將永久禁止對其進行編輯,並使用鍵盤我不能添加任何文字。我不知道我會在哪裏放置我的代碼,或者確認何時需要鍵盤才能使用它。 我看看我是否需要隱藏鍵盤,我必須對鍵盤按鍵或什麼事件這樣
private void TextBox_KeyUp(object sender, KeyRoutedEventArgs e)
{
if(e.Key==Windows.System.VirtualKey.Enter)
{
Windows.UI.ViewManagement.InputPane.GetForCurrentView().TryHide();
}
}
,但沒有搞清楚!
更新1: 我添加此代碼
private void MyTextNote_GotFocus(object sender, RoutedEventArgs e)
{
InputPane.GetForCurrentView().TryHide();
}
,並幫我不能顯示的鍵盤,但我需要表現出來,當我點擊文本框,我嘗試絲毫挖掘,但沒有幫助。
如果你是好與禁用您文本框,爲什麼不使用一個標籤呢? – yoogeeks
我不想禁用我的文本框,我使用手寫識別來添加一些單詞,如果有一些錯誤的單詞,我想嘗試修改它,所以我需要將文本框 – Amin
設置爲關閉TextBox。 – yoogeeks