lentinant
lentinant

Reputation: 832

Application.Current.MainWindow and splash screen

I'm using custom splash screen for my application, which is actually another window. I'm creating it in App constructor (to be exact, in one of setup methods called from there) and destroying it in OnStartup event (right after application window is created).

But it seems, that application gets splash screen as main window (since it is called before actual app window is created), and this causes numerous problems. So, how can I make my app to ignore splash screen window (in Application.Current.MainWindow context)?

Note, that I'm creating app window programmaticaly, so I can't simply specify it in XAML.

Upvotes: 1

Views: 1403

Answers (2)

lentinant
lentinant

Reputation: 832

According to the documentation on MSDN, the first Window instantiated in the AppDomain is placed in MainWindow. So, it seems I need to assign it manually.

Upvotes: 0

Glen Thomas
Glen Thomas

Reputation: 10764

You can set the application's MainWindow to be any Window using the static MainWindow property of Application:

Application.Current.MainWindow = MyWindow;

Upvotes: 1

Related Questions