Frame91
Frame91

Reputation: 3789

Keybindings to simulate next tabstop in WPF

I got a ListBox where I'd like to "simulate" the next/previous tab key when entering a different key.

Means: If I press "Enter" I'd like to have the behaviour of "NextTab".

<ListBox>
  <ListBox.InputBindings>
    <KeyBinding Key="Enter" Command="{HereNextTabPlease}" />
  </ListBox.InputBindings>
</ListBox>

Do I have to do it over a ViewModel, which should implement a Property "NextTabCommand" and then informs the View to change the CurrentTab? Or is there anything within XAML to do so? Like:

 <KeyBinding Key="Enter" Command="{Window.NextTab}" />

I don't like to put this information into my viewmodel - it'd be such an overload

Upvotes: 1

Views: 226

Answers (1)

S.N
S.N

Reputation: 5140

If I get it correct, you wanted to select control when you press Enter key which does the what otherwise done achieve through tabbing. If so, I don't think there any inbuilt mechanism which does that. However, similar is achieved through attached property here and all credit goes to Matt Hamilton.

Upvotes: 1

Related Questions