I've got a WPF view with two textboxes. I'd like to automatically move focus forward from the first textbox to the second when the user hits the down arrow on the keyboard exactly like Tab does.
It seems like I ought to be able to do this 100% declaratively, but for some reason the commands I thought would do this don't seem to do anything. Here is my first attempt that doesn't work:
<StackPanel>
<TextBox Text="Test">
<TextBox.InputBindings>
<!-- I realize ComponentCommands.MoveFocusDown doesn't work...
This is just an example of what I've tried and the type
of answer I'm looking for -->
<KeyBinding Key="Down" Command="ComponentCommands.MoveFocusDown" />
</TextBox.InputBindings>
</TextBox>
<TextBox></TextBox>
</StackPanel>
Does anyone have any experience with this? Seems like I ought to be able to use either InputBindings or an EventTrigger to do this.
I'm using MVVM and this is a View concern. I could just drop in a little codebehind (being a view concern, this is reasonable), but it just feels like I'm missing something.