I have a WPF application.
The page that opens when the app runs in MainWindow.xaml
, as set in the StartupUri attribute of the App.xaml
file. This page opens fine.
However, if I try to open any other windows using the Show or ShowDialog method I get an IOException
in the InitializeComponent
method saying "Cannot locate resource 'Window1.xaml'"
(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.
Any idea what's going on?
Best Answer
The above did not work for me but what did work was as follows. Open up the
App.xaml
You then need to change the start-up URI to the fully qualified one. In my case I had moved my
MainWindow.xaml
to a folder called 'Main', so changing the above URI toSolved my issue.