I am developing a WPF application and I need to get a point to the main window of application inside a control. I am using Caliburn Micro.
Application.Current.MainWindow
is null
How can I get a reference to the MainWindow
of application in Caliburn Micro?
That's funny, I've just answered this in another post... Try setting the Application.Current.MainWindow
property in the Loaded
event in the MainWindow.xaml.cs
file:
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
Application.Current.MainWindow = this;
}