【发布时间】:2011-08-15 07:46:54
【问题描述】:
可能重复:
The best approach to create new window in WPF using MVVM
朋友们好,
我有两个视图 MainWindowView 和 AddCustomerView。我在 MainwindowView.xmal 中有包含按钮的菜单。
如何通过单击按钮从 MainWindowViewModel 弹出 AddCustomerView。
我的 App.xmal.cs 的启动代码是..
base.OnStartup(e);
MainWindow window = new MainWindow();
var viewModel = new MainWindowViewModel();
window.DataContext = viewModel;
window.Show();
在按钮执行代码中显示 AddCustomerView 的代码是什么。
public void AddNewCustomerWindowExecute() //This is button handler
{
// How to show AddCustomerView from MainWindowViewModel
}
【问题讨论】: