移动MainWindow.xaml [英] Moving MainWindow.xaml
问题描述
我已经构建了一个WPF应用程序,该应用程序现在可以完全运行.但是,为了稍微整理一下,我希望将 MainWindow.xaml
移到我创建的视图文件夹中.完成此操作后,该应用程序将无法运行,并且给了我一个未知的构建错误" ,它没有提供有关如何修复该问题的任何信息...
我应该在我的 MainWindow.xaml
中进行哪些更改,以使该应用程序再次正常运行?
I've built a WPF app, which completely works now. However, to clean it up a bit I wish to move my MainWindow.xaml
to the view folder I've created. After I've done this the application won't run and it gives me an "Unknown build error" which doesn't give any info on how to fix it...
What should I change in my MainWindow.xaml
to let the app work properly again?
我已经改变了
<Window x:Class="projectname.MainWindow">
到
<Window x:Class="projectname.view.MainWindow">
我还应该更改其他内容吗?
Should I change other stuff as well?
推荐答案
除非已更改类的名称空间,否则无需更新xaml文件中的类名称.您很可能没有为 App.xaml
更新 StartupUri
.更改为:
You don't need to update class name in xaml file unless you have changed the namespace of your class.
Most likely you haven't updated StartupUri
for App.xaml
. Change it to:
StartupUri="view/MainWindow.xaml"
来自
StartupUri="MainWindow.xaml"
这篇关于移动MainWindow.xaml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!