开发者

Conditional Keybinding

开发者 https://www.devze.com 2023-04-08 09:19 出处:网络
I was wandering if someone could explain to me how I could do a conditional key binding (u开发者_JAVA百科sing an MVVM pattern), at the moment I have

I was wandering if someone could explain to me how I could do a conditional key binding (u开发者_JAVA百科sing 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


If you have a command, shouldn't the CanExecute part handle that by not always returning true?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号