我与AddEditViewModel
和AddEditView
相关联。我想使用ViewModel2
对象从IWindowManager
启动对话框窗口。来自ViewModel2
class的代码:
windowManager.ShowDialog(new AddEditViewModel(_windowManager,_events),
this.SelectedCar, settings);
但我不知道如何恢复this.SelectedCar
中的对象AddEditViewModel
?有可能吗?
答案 0 :(得分:1)
您可以在显示对话框后访问该对象:
var model = new AddEditViewModel(_windowManager, _events);
dynamic settings = new ExpandoObject();
settings.WindowStyle = WindowStyle.ToolWindow;
settings.ShowInTaskbar = true;
settings.Title = "This is a custom title";
var result = windowManager.ShowDialog(model, null, settings);
var car = model.SelectedCar;