mvvm light MIX10 演示 RelayCommand 问题
有人看过 Laurent Bugnion 在 MIX10 上的精彩演示吗?如果您喜欢 MVVM-light,我认为它是必看的,我确实有一个无法解决的问题...在使用 RelayCommand 的演示中,他做了两个示例 - 一个是我们实现 Icommand 本身一种是使用 MVVM Light 中的 RelayCommand。在第二个示例中,他特别指出,当 Counter 属性更改时,您需要在 SayHello 命令中调用 RaiseCanExecuteChanged。但我评论了这一点并且它有效...
抱歉 - 你必须熟悉演示才能得到这个问题,但我希望有人可能...我也希望有人可以解决这个问题 - 我似乎不知道为什么我们需要做他所说的事情,因为否则效果很好。
谢谢!!!
Has anyone seen Laurent Bugnion's great demo at MIX10? If you are into MVVM-light I would call it a must see, I do have a question that I can't see to figure out... In the demo that uses RelayCommand, he does two examples - one where we implement Icommand itself and one where use RelayCommand from MVVM Light. On the second example he specifically says that you need to call RaiseCanExecuteChanged in the on the SayHello command when the Counter property changes. but I commented this out and it works...
Sorry - you have to be familiar with the demo to get this question but I hope someone might be... I also hope someone can clear this up - I don't seem to know why we need to do what he is talking about cause it works just fine otherwise.
Thanks!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我无法谈论驱动此问题的具体内部接线,因此请记住我的评论。
我相信数据绑定将定期(有时智能地)重新查询 ICommand 的 CanExecute 方法。调用 RaiseCanExecuteChanged 是确保按钮尽快重新查询的一种方法。
如果其他人可以解释按钮何时决定何时重新查询,我也很想知道。
I can't speak to the specific internal wiring that drives this, so take my comments with that in mind.
I believe that data binding will routinely (and sometimes intelligently) requery the CanExecute method of ICommand. Calling RaiseCanExecuteChanged is a way of ensuring that button will requery it as soon as possible.
If anyone else can explain when buttons decide when to requery, I'd love to know that too.