Here is the correct way to load a window in WPF. Notice the hooking the Loaded event in the constructor.
public MainWindow()
{
InitializeComponent();
Loaded += new RoutedEventHandler(Window_Loaded);
//MyBigRoutine(); -- Don't do this.
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
MyBigRoutine();
}
No comments:
Post a Comment