Just do the following:
this.Close(); SignInWindow signIn = new SignInWindow(); signIn.ShowDialog();
remember to actually close MainWindow . If all you are really trying to do is hide it, then do the following:
this.Hide(); SignInWindow signIn = new SignInWindow(); signIn.ShowDialog(); this.Show();
This will hide MainWindow until the login form is completed, and then show it again when it is complete.
Ok, so apparently you are running this form from a static class that is outside . This would be very relevant information. But the solution would be this:
var w = Application.Current.Windows[0]; w.Hide(); SignInWindow signIn = new SignInWindow(); signIn.ShowDialog(); w.Show();
source share