wpf prism 自定义委托命令DelegateCommand
//构造函数
public MainWindowViewModel()
{
EditCommand = new DelegateCommand(_editCommand);
}
//命令声明一
public DelegateCommand EditCommand { get; set; }
//构造函数中实例化委托
void _editCommand() {
MessageBox.Show("EditCommand ");
}
//命令生命方式二
private DelegateCommand _testCmd;
public DelegateCommand TestCmd =>
_testCmd ?? (_testCmd = new DelegateCommand(ExecuteTestCmd));
void ExecuteTestCmd()
{
MessageBox.Show("ExecuteTestCmd");
}