How to navigate to other page with button in WPF

后端 未结 7 1644
没有蜡笔的小新
没有蜡笔的小新 2021-02-05 15:56

I have a second .xaml page set up under the name Page2.xaml and I want to make it so that when my button is clicked, the user is taken to <

7条回答
  •  长情又很酷
    2021-02-05 16:08

    You should use this, this worked for me:

    var Page2= new Page2(); //create your new form.
    Page2.Show(); //show the new form.
    this.Close(); //only if you want to close the current form.
    

    There is a variable type of a page with the page.xaml right name in your solution. after that, you should use its methods to do it functionally.

提交回复
热议问题