Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error after changing name of mainwindow

Tags:

c#

wpf

I'm using WPF for the first time and I get an error like this:

Cannot locate resource 'mainwindow.xaml'

That is becuase I changed the name. Have I missed to change this is some other code? I'm not so familiar with this type of projekt, compared with Windows Form that I used before. Which file launch the application? I have been looking for one in the solution explorer. I guess it's perhaps there the error is?

like image 420
3D-kreativ Avatar asked Aug 09 '12 06:08

3D-kreativ


2 Answers

Change it in StartupUri attribute of Application tag in App.xaml also.

like image 162
Nikhil Agrawal Avatar answered Sep 28 '22 00:09

Nikhil Agrawal


After renaming a window project item:

  • rename startup URI in App.xaml to corresponding WindowName.xaml;
  • check x:Class attribute value in window XAML file, it must be match class name in code behind.
like image 39
Dennis Avatar answered Sep 28 '22 00:09

Dennis