Reputation: 689
I just started with wpf. I want to have two windows. I did Projects -> Add Window and named it Window2. In my project explore I have MainWindow.xaml, MainWindow.xaml.cs, Window2.xaml and Window2.xaml.cs
When I tried to run the project only MainWindow shows up eventhough in Windows.xmal.cs I have it Initialized.
public partial class Window2 : Window
{
public Window2()
{
InitializeComponent();
}
}
Why wont window2 show up when I start it?
Upvotes: 0
Views: 1683
Reputation: 10789
The simplest way would be within the constructor of MainWindow
make Window2
appear.
Other windows will not automatically appear unless you display them.
public MainWindow()
{
InitializeComponent();
Window2 win = new Window2();
win.Show();
}
Upvotes: 2