I need to call a method the first thing after the MainWindow is built. I've added this code to the XAML:
Loaded="MainWindow_Loaded"
And this method to MainWindow:
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
SelectScenario dlg = new SelectScenario();
dlg.Top = 22;
dlg.ShowDialog();
if (ScenarioSelected == true)
{
LoadScenarioFile(SelectedScenario);
}
}
But the SelectScenario dialog box is being called before the MainWindow is fully built. Where can I insert the method call for the SelectScenario dialog box so I know the MainWindow has been completely built?
There's an event called "ContentRendered" you could try this instead of loaded.