Prism中命令可用性无法自动刷新

http://*.com/questions/2444927/wpf-prism-canexecute-method-not-being-called

It is most likely that the bound control is never asking for the CanExecute state again. You need to call the RaiseCanExecuteChanged method on the DelegateCommand whenever you detect a condition that changes the command's CanExecute state. This signals the bound control to update theCanExecute state.

solution

    private void RaiseCanExecuteChanged()
{
DelegateCommand<object> command = LoginCommand as DelegateCommand<object>;
command.RaiseCanExecuteChanged();
} public const string UsernameProperty = "Username";
private String _username;
public String Username
{
get { return _username; }
set
{
_username = value;
this.NotifyPropertyChanged(UsernameProperty);
RaiseCanExecuteChanged();
}
}
上一篇:Objective-C日记-之编码对象属性


下一篇:tomcat catalina.out日志切割(logrotate)