I have a text box and below it I have a list.
While the user enters a text box, if he presses the up or down arrow, he must make a choice in the list. The text box detects all characters (except space), but it seems that it cannot detect arrows.
Any solution for this? This is a WPF project.
EDIT, here's the working code thanks to T.Kiley:
private void searchBox_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.IsDown && e.Key == Key.Down)
{
e.Handled = true;
}
if (e.IsDown && e.Key == Key.Up)
{
e.Handled = true;
}
}
Kitze source
share