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 meth开发者_JAVA技巧od of the Application class.
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.
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();
}
}
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...
精彩评论