Splash screen problem

Sep 5, 2011 at 5:12 PM

Hello,

well we all like a splash screen from time to time don't we? I just tried to add one to my project which uses Catel and I'm getting a strange behaviour that once the MainWindow gets rendered the splash screen closes but it also closes the MainWindow which exits the application.

I tried using the splash screen from code and from Build Action with the same effect, any ideas?

Coordinator
Sep 6, 2011 at 7:41 AM

The reason for this is that WPF automatically uses the first instantiated window as the main window of the application. Thus, if you create the splashwindow, that will become the main window. If you close that, you close the app. What you should do is create the MainWindow (not write ANY logic in the constructor), then show the splash window which will initialize all data, etc. Finally, when the splash window is done, show the main window.

Sep 6, 2011 at 10:33 AM

That sorted it, thank you.