This project is read-only.

Key.Enter handling in AutoCompleteBox


The problem is user can't handle the Enter key pressed event in this control. It is because this key is used in this control to choose the element in the dropped list. However, user may need to handle this key when the list isn't dropped down. For instance, I need to implement behaviour like AutoCompleteBox in Google's page where enter means "start searching".
It is easy to fix this problem - you just need to change the code in AutoCompleteBox.cs, line 2705 this way:
            case Key.Enter:
                if (IsDropDownOpen)
                    OnAdapterSelectionComplete(this, new RoutedEventArgs());
                    e.Handled = true;
Any way I added patch for this issue.


Dev07 wrote Dec 20, 2016 at 8:05 PM

I know it is very late. I used PreviewKeyDown event handler to capture the Enter key.