开发者

Events of AutoCompleteBox in WP7

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 :

  1. when the user s开发者_运维知识库elects a value in the AutoCompleteBox DropDown
  2. 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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜