如何使用CommandParameter传递UserControl?

我使用DelegateCommand,我想通过Command传递UserControl。

#region OpenViewCommand private DelegateCommand _openViewCommand; public ICommand OpenViewCommand { get { if (_openViewCommand == null) _openViewCommand = new DelegateCommand(new Action(OpenView)); return _openViewCommand; } } public void OpenView(UserControl ViewName) { UserControl ctrl = (UserControl)ViewName; JIMS.Controls.Message.Show(ViewName.ToString()); } #endregion 

XAML中的命令

  

如果你给UserControl一个x:Name(例如“MyView”),你应该可以这样做: