ASHOK A ASHOK A - 3 months ago 31
C# Question

How to open second window from first window in wpf?

I am new to wpf.I have two window 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.Here the code what i tried.

window2.show();

Answer

Write your code in window1.

private void Button_Click(object sender, RoutedEventArgs e)
{
    window2 win2 = new window2();
    win2.Show();
    this.Close();
}