Consider the following code:
private void Window_Loaded(object sender, RoutedEventArgs e)
{
MessageBox.Show("MyMessage");
}
If I am trying to display a message box after a WPF window has been loaded, when I run the application, the WPF window is displayed with a transparent background (only the non-client area is visible) and it takes 3-5 seconds until the message box appears. The WPF window returns to normal only after the message box has been closed.
Is this normal? Does anyone else experience this?
EDIT: I have added a screenshot of how the window looks like:

The
MessageBoxis getting shown at theNormalDispatcherPriority, which occurs before things likeDataBind,Render, andLoaded, so the code that initializes your Window’s objects is not getting run until after you dismiss theMessageBoxYou can fix this by simply showing the
MessageBoxat a later DispatcherPriority, such asBackground