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
如果您有命令,那么CanExecute
部分不应该通过不总是返回true来处理该命令吗?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.