lundi 23 mars 2015

How to I know when WPF application has opened the main window?

I'm playing around with WPF for the first time. I've created a sample project in VS2013 with the default "App" and "MainWindow" classes. When I run it, it loads up the MainWindow XAML just fine.


As I start to modify the original code, I want to have the Application object subscribe to certain events for the MainWindow but you can't do that until after the window is created. I figured there'd be an event in the Application class that would fire when it was done processing the XAML and creating the window, but so far I've not found it.


If I add handlers for the Application.Startup or Application.LoadCompleted events, they're called before MainWindow is created.


I'm gonna spend this evening reading up on WPF but thought I'd throw the question out here and see if anybody had suggestions.


Aucun commentaire:

Enregistrer un commentaire