title: WPF IOException Cannot locate resource
body: <p>I have a WPF application. </p>
  
  <p>The page that opens when the app runs in <code>MainWindow.xaml</code>, as set in the <em>StartupUri</em> attribute of the <code>App.xaml</code> file. This page opens fine. </p>
  
  <p>However, if I try to open any other windows using the <strong>Show</strong> or <strong>ShowDialog</strong> method I get an <code>IOException</code> in the <code>InitializeComponent</code> method saying <code>"Cannot locate resource 'Window1.xaml'"</code> (or whatever the file is called). This happens with every single window I create. I've searched online but all the solutions seem to say "make sure the StartupUri attribute of the App.xaml is correct" and mine is, hence MainWindow opening. </p>
  
  <p>Any idea what's going on?</p>