KeyDown Event, triggered when AutoCompleteBox drop-down is opened

122 views Asked by At

enter image description here

In AutoCompleteBox, when drop-down is opened and key is pressed (for example Enter) control's KeyDown event is not arroused, and this makes to press Enter two times. I'm trying to make small dialog box, that doesn't oblige user to press keyboard buttons lots of times, but which closes with result when user has found his variant and presses Enter only one time. How to catch this event?

AXAML:

<AutoCompleteBox
    FilterMode="Contains"
    KeyDown="InputBox_KeyDown"/>

C#:

private async void InputBox_KeyDown(object sender, KeyEventArgs e)
{
    if (e.Key == Key.Enter)
    {
        // Getting form result
        Close();
    }
}
0

There are 0 answers