My scenario:
I have a simple Telerik GridView and a single Textbox in my WPF App. When I type in the TextBox (FilterBox), I update some FilterDescriptor values and the GridView gets filtered accordingly.
What I want to achieve:
Basically the same behaviour as the Google Chrome Browser in "Search-Mode"; The FilterBox receives all Keyboard presses EXCEPT the arrow keys and "Page Up", "Page Down". Those button presses should be redirected to the GridView, allowing the users to scroll through the filtered results while keeping the focus on the FilterBox (and so allow them to adjust the filter text until they are satisfied with the results).
I've tried handling the PreviewKeyDown event of the FilterBox in the following way:
The code works (the up and down arrow keys control the grid), but the FilterBox loses the focus.
What do I have to do?
I have a simple Telerik GridView and a single Textbox in my WPF App. When I type in the TextBox (FilterBox), I update some FilterDescriptor values and the GridView gets filtered accordingly.
What I want to achieve:
Basically the same behaviour as the Google Chrome Browser in "Search-Mode"; The FilterBox receives all Keyboard presses EXCEPT the arrow keys and "Page Up", "Page Down". Those button presses should be redirected to the GridView, allowing the users to scroll through the filtered results while keeping the focus on the FilterBox (and so allow them to adjust the filter text until they are satisfied with the results).
I've tried handling the PreviewKeyDown event of the FilterBox in the following way:
private void textFilter_PreviewKeyDown(object sender, KeyEventArgs e)
{
switch (e.Key)
{
case Key.Down:
{
e.Handled = true;
RoutedUICommand moveDownCommand = RadGridViewCommands.MoveDown as RoutedUICommand;
RoutedUICommand selectCommand = RadGridViewCommands.SelectCurrentUnit as RoutedUICommand;
moveDownCommand.Execute(null, this.radGridView);
selectCommand.Execute(null, this.radGridView);
break;
}
case Key.Up:
{
e.Handled = true;
RoutedUICommand moveUpCommand = RadGridViewCommands.MoveUp as RoutedUICommand;
RoutedUICommand selectCommand = RadGridViewCommands.SelectCurrentUnit as RoutedUICommand;
moveUpCommand.Execute(null, this.radGridView);
selectCommand.Execute(null, this.radGridView);
break;
}
default:
return;
}
textFilter.Focus();
}
What do I have to do?