I'm using the AutoCompleteBox of the silverlight toolkit in my WP7 application. When the box has focus, the SIP (soft input panel) popus up. Good.
Now, I would like to be able to detect :
- when the user s开发者_运维知识库elects a value in the AutoCompleteBox DropDown
- when the user clicks on "enter" in the SIP, that means he validates his inputs
This should be 2 differents events as I have 2 differents things to do in both cases.
There's the SelectionChanged event, But I'm unable to make the difference...
Thanks in advance for any help.
Best regards
You can use .Focus() on another control on the page to close the SIP.
You can test for the Enter key in the OnKeyUp event for the TextBox and move the focus.
e.g.
private void myAutocompleteBox_KeyUp(object sender, System.Windows.Input.KeyEventArgs e) {
if (e.Key == Key.Enter) {
addButton.Focus();
}
}
You can also test for an item selected by the AutoCompleteBox in the Textbox.SelectionChanged event and move the focus.
This post demonstrates doing the latter.
AutoCompleteBox in Windows Phone 7 « Roger Gullhaug's Blog
精彩评论