开发者

In WPF/Prism, what happens with a CompositeCommand when a DelegateCommand.RaiseCanExecuteChanged is fired?

开发者 https://www.devze.com 2023-01-27 04:00 出处:网络
Say that I have a CompositeCommand with a lot of DelegateCommands registered. If one of the child DelegateCommands fires up RaiseCanExecuteChanged, this will result in firing the event CompositeC开发

Say that I have a CompositeCommand with a lot of DelegateCommands registered.

If one of the child DelegateCommands fires up RaiseCanExecuteChanged, this will result in firing the event CompositeC开发者_JS百科ommand.CanExecuteChanged, raising this same event in the other children, or it will only affect the active DelegateCommand?


Just figured this out. By analyzing the internals of Prism, I noticed that the CompositeCommand registers itself in its children's CanExecuteChanged event. Thus, everytime a registered command raises the CanExecuteChanged handler, the composite command does the same in itself and in all of its children.

0

精彩评论

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