jjzjj

CanExecuteChanged

全部标签

c# - C# ActionCommand :ICommand into VB.net 翻译

我找到了一个C#类ActionCommand,它实现了ICommand并基于Execute和CanExecute的委托(delegate)。到目前为止对我来说看起来很完美。publicclassActionCommand:ICommand{privatereadonlyAction_executeHandler;privatereadonlyFunc_canExecuteHandler;publicActionCommand(Actionexecute,FunccanExecute){if(execute==null)thrownewArgumentNullException("Exe

c# - ICommand 的 CanExecuteChanged 事件

Icommand包含两个方法和一个事件。两个方法的作用很清楚,但是我无法理解ICommand中提供的事件是做什么的。CanExecuteChanged事件何时引发?下面的解释在MSDN但是我看不懂CanExecuteChangedisraisedifthecommandmanagerthatcentralizesthecommandingoperationsdetectsachangeinthecommandsourcethatmightinvalidateacommandthathasbeenraisedbutnotyetexecutedbythecommandbinding.您能用