I'd like to start with the disclaimer that I'm not far off an absolute beginner.

Opening up a window in WPF is quite easy, I've done it before in a previous project and it worked fine.

However, I am struggling to do it again in this new project (login form). I have two classes, MainWindow and CreateAccount.

MainWindow has the event trigger for opening up the CreateAccount window.

Code:
 private void Button_Click(object sender, RoutedEventArgs e)
        {
           
          var account = new CreateAccount(); 
            account.Show();
            this.Close(); 
        }
What this does is it opens up a blank window with all the default dimensions, clearly it's able to create a NEW window - but not the one designed by me. But code-wise I can't see anything wrong with what I've done.

The CreateAccount class is mostly just some if statements (I don't want to hunker down with it until I sort out the current issue) and I can't find anything that would cause issue.

Both classes inherit from Window. I took a guess at the problem thinking 'maybe its an inheritance issue' and so tried to make CreateAccount inherit from MainWindow, but that threw an error. Right now I'm lost as to what the problem is and since I don't know that, I can't find out the solution.

Is there anything wrong with the code? Someone suggested that it might be a DataContext issue, but even after looking that up I'm struggling to understand it.

Thank you if you can help. It seems like such a small thing.