我对 WPF MVVM 模式非常陌生,尤其是commands
ViewModel
包含命令
public ICommand MyButtonClickCommand
{
get { return new RelayCommand(FuncToCall); }
}
private object FuncToCall(object context)
{
MessageBox.Show("The button was Clicked", "");
return null;
}
和RelayCommandClass.cs
private Action<object> _action;
public RelayCommand(Action<object> action)
{
_action = action;
}
在编译时我得到FuncToCall(object)' has the wrong return type
谢谢你们