WPF MVVM在viewModel中关闭view界面
ViewModel中添加 public Action CloseAction { get; set; }
view中xaml.cs文件中添加
var viewModel = IocManager.Instance.Resolve<LoginWindowViewModel>();
DataContext = viewModel;
viewModel.CloseAction = Close;
然后在ViewModel中需要关闭的地方加CloseAction();