1
votes

Im new to the MVVM Pattern, i think this question willbe rather easy for you guys.

I created a new wpf project so far and added 3 folders(model, view, view model). I dragged and dropped the mainwindow.xaml file into the view folder and added a button to the xaml so far. At Runtime i get an error cant find "mainwindow.xaml" reference or something like that. I think i just have to set the path to that file somewhere but i dont know where.

thanks for your help.

1
keep in mind that new files which you add to your folders will have different namespaces, eg. MyApp.View.MyView (unless you changed that behavior in VS options I guess). To have your namespaces consistent, you should delete automatically created MainWindow.xaml, add the new one to folder and modify App.xaml accordinglyamnezjak

1 Answers

2
votes

Your App.xaml file will be looking for this file on application startup.

If you are using the MainWindow.xaml file in the same project, change the StartupUri in the App.xaml file to "View\MainWindow.xaml" and this should resolve the issue.