title: How do I open two windows on launch in WPF?
body: <p>I feel like I am missing something very fundamental here, but I can't seem to find an answer.</p>
  
  <p>When my app launches, I want a second <code>window</code> based on existing <code>xaml</code> to open in addition to <code>MainWindow.xaml</code>.  I've found a lot about using code-behind to create a NEW <code>window</code>, but I want to open a <code>window</code> that is predefined in another <code>xaml</code> file.</p>
  
  <p>Both are using MahApps and are defined as </p>
  
  <pre><code>&lt;Controls:MetroWindow x:Class=...
    ...
  &lt;/Controls:MetroWindow&gt;
  </code></pre>
  
  <p>The second <code>window</code> is called <code>ControlWindow.xaml</code> and sits in the root with <code>MainWindow.xaml</code></p>
  
  <p>Thank you</p>
  
  <p>EDIT:</p>
  
  <p>When trying to create and show the window in the App_Startup event in app.xaml.cs, even though the window inherits from the same class as MainWindow.xaml, it does not have the Show() method available.</p>
  
  <p>MainWindow.xaml.cs</p>
  
  <pre><code>using MahApps.Metro.Controls;
  
  namespace RollCallDisplayDemo
  {
      public partial class MainWindow : MetroWindow
      {        
          public MainWindow()
          {
              InitializeComponent();
          }
      }
  }
  </code></pre>
  
  <p>ControlWindow.xaml.cs</p>
  
  <pre><code>using MahApps.Metro.Controls;
  
  namespace RollCallDisplayDemo
  {
      public partial class ControlWindow : MetroWindow
      {
          public ControlWindow()
          {
              InitializeComponent();
          }
      }
  }
  </code></pre>
  
  <p>App.xaml.cs</p>
  
  <pre><code>using System.Windows;
  using GalaSoft.MvvmLight.Threading;
  
  namespace RollCallDisplayDemo
  {
      public partial class App : Application
      {
          void App_Startup(object sender, StartupEventArgs e)
          {
              MainWindow NewWindowA = new MainWindow();
              ControlWindow NewWindowB = new ControlWindow();
          }
  
          static App()
          {
              DispatcherHelper.Initialize();
          }
      }
  }
  </code></pre>
  
  <p>NewWindowA acts as you would expect and allows a new instance to be created and shown.  NewWindowB only has the InitializeComponent method available, nothing else which should inherited from the MetroWindow class.</p>