Reputation: 104711
Hello I am trying to handle the Application.LoadCompleted
event but it's never triggered.
Instead I am seeing the MainWindow.
I tried attaching the event by either xaml, or directly by overriding the OnLoadCompleted method of the Application class.
Upvotes: 3
Views: 3243
Reputation: 145890
It's possible you're using the wrong event for what you want.
If you are just trying to initialize your application - perhaps to set up global messaging handlers or you can use OnStartup
.
public partial class App : Application
{
static App()
{
DispatcherHelper.Initialize();
}
protected override void OnStartup(StartupEventArgs e)
{
InitializeMVVM();
}
}
Upvotes: 3
Reputation: 178630
It could be simply that you're attaching the event too late. i.e. after the loaded event has already fired. Show us the code...
Upvotes: 0
Reputation: 273179
Does your MainWindow contain a Frame?
If you read the text for the event (not the On... method), it says
Occurs when content that was navigated to by a navigator in the application has been loaded
I just tested on a Form with a Frame and the event fires just fine.
Upvotes: 5