My MainWindow has some KeyBindings:
<Window.InputBindings>
<KeyBinding Command="{Binding NewFileCommand}" Key="{Binding NewFileCommand.Key}" Modifiers="{Binding NewFileCommand.Modifiers}" />
</Window.InputBindings>
They´re working, as long as i clicked somewhere into the content of my Window. But if I use Alt+Tab to switch between Applications (let´s say MS Word and my App) the Shortcuts won´t work anymore until I click again somewhere into the View. Same when selecting the Application-Window via Mouse on the Border.
How can I make them working?
In my repro, I used the RelayCommand from MVVM Light which worked fine. I’m guessing that you are using something else. Try adding this code in your window:
That tells the command framework that something has changed and it should re-evaluate the CanExecute status of each command.