How do I open a second window from the first window in WPF?

前端 未结 9 1414
一个人的身影
一个人的身影 2020-11-29 20:46

I am new to WPF. I have two windows, such as window1 and window2. I have one button in window1. If I click that button, the window2 has to open. What should I do for that?

9条回答
  •  广开言路
    2020-11-29 21:17

    You can use this code:

    private void OnClickNavigate(object sender, RoutedEventArgs e)
    {
        NavigatedWindow navigatesWindow = new NavigatedWindow();
        navigatesWindow.ShowDialog();
    }
    

提交回复
热议问题