Reputation: 2214
I was wandering if someone could explain to me how I could do a conditional key binding (using an MVVM pattern), at the moment I have
<Window.InputBindings>
<KeyBinding Command="{Binding Path=CMD_Login}" Gesture="Enter" />
</Window.InputBindings>
but I would like this key-binding to only be active if the user is logging in. They login window is set to visible/collapse depending if the user is logging in or not, so was wandering if the conditional can possibly be based on that?
Thank You
Upvotes: 2
Views: 768
Reputation: 184506
If you have a command, shouldn't the CanExecute
part handle that by not always returning true?
Upvotes: 1