mikey555
mikey555

Reputation: 454

how can my WPF launch two windows?

apologies, really new C# learner. my application will have these windows:

how can I make it so that when the application starts, both of these windows open, and how would I go about making user decisions in the options window affect display in the main window?

Thanks!

Upvotes: 1

Views: 4763

Answers (2)

Mahmoud Gamal
Mahmoud Gamal

Reputation: 79889

Inside the OnStartup method of App.xaml.cs, add the following:

Window2 window = new Window2();
window.Show();

and the main window will be displayed by default since it is defined as the start window in your App.xaml property StartupUri="MainWindow.xaml"

Upvotes: 2

SLaks
SLaks

Reputation: 887215

In the main window's constructor, create a new instance of the Options window class and call Show().

To make the two classes interact, you can pass a reference to the main window to the options window.

Upvotes: 3

Related Questions