MVVM使用命令从Mainview打开视图

时间:2018-12-28 04:31:44

标签: wpf mvvm view

我试图通过按钮单击命令从主视图中打开视图,我只需要知道我必须在方法GoToNewPage()中替换的内容

private DelegateCommand newPageCommand;

    public ICommand NewPage
    {

        get
        {

            if (newPageCommand == null)
            {
                newPageCommand = new DelegateCommand(GoToNewPage);
            }
            return newPageCommand;
        }
    }


    private void GoToNewPage()
    {
      //What i have to write there?
    }

1 个答案:

答案 0 :(得分:-1)

private void GoToNewPage()
{
    var window = new ViewClassName();
    window.Show();
}