Tuesday, March 20, 2012

AutoCompleteBox KeyPress

I was looking for ways to get enter key in an AutoCompleteBox. But no events supports it. Key Down event of AutoCompleteBox does not trigger the EnterKeyEvent.

Solution:

Create a custom NewAutoCompleteBox then inherit AutoCompleteBox.
Override OnKeyDown
Access the base.OnKeyDown(e); then this will trigger the enter key event.

        if(e.Key == Key.Enter) RaiseEnterKeyDownEvent();



No comments:

Post a Comment