Command可以根据CommandParameter传参
关键代码
public ICommand SubmitCommand => _submitCommand; private RelayCommand _submitCommand = new RelayCommand(new Action(ShowMessage)); private static void ShowMessage(object obj) { MessageBox.Show(obj.ToString()); }
也可以这样绑定
姓名:年龄:
示例代码
Command与Click的关系
Command用于后台操作,click用于前台展示、交互,可以共存