我开始学习WPF,我抓住Family.Show项目作为一个真实世界的例子来帮助我学习。它有一个非常好的用户界面,以及家谱中主要面板中的一些很酷的动画 - 我很想知道他们是如何做到的。
所以我下载了源代码(http://familyshow.codeplex.com/releases/view/23637#DownloadId=59428),在VS2010 Professional中打开3.0解决方案,让它进行转换...试过打开MainWindow.xaml然后得到:
Error 1 Undefined CLR namespace. The 'clr-namespace' URI refers to a namespace 'Microsoft.FamilyShow' that is not included in the assembly. C:\Users\nloding\Documents\Visual Studio 2010\Projects\Family.Show-3.0\FamilyShow\MainWindow.xaml 7 15 FamilyShow
Error 2 The type 'local:DiagramViewer' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. C:\Users\nloding\Documents\Visual Studio 2010\Projects\Family.Show-3.0\FamilyShow\MainWindow.xaml 118 12 FamilyShow
Error 3 The type 'local:Details' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. C:\Users\nloding\Documents\Visual Studio 2010\Projects\Family.Show-3.0\FamilyShow\MainWindow.xaml 128 10 FamilyShow
Error 4 The type 'local:NewUserControl' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. C:\Users\nloding\Documents\Visual Studio 2010\Projects\Family.Show-3.0\FamilyShow\MainWindow.xaml 133 8 FamilyShow
Error 5 The type 'local:Welcome' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. C:\Users\nloding\Documents\Visual Studio 2010\Projects\Family.Show-3.0\FamilyShow\MainWindow.xaml 136 8 FamilyShow
Error 6 The type 'local:PersonInfo' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. C:\Users\nloding\Documents\Visual Studio 2010\Projects\Family.Show-3.0\FamilyShow\MainWindow.xaml 139 8 FamilyShow
Error 7 The type 'local:FamilyData' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. C:\Users\nloding\Documents\Visual Studio 2010\Projects\Family.Show-3.0\FamilyShow\MainWindow.xaml 142 8 FamilyShow
Error 8 The type 'local:OldVersionMessage' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. C:\Users\nloding\Documents\Visual Studio 2010\Projects\Family.Show-3.0\FamilyShow\MainWindow.xaml 143 8 FamilyShow
设计师什么也没说。我已经验证了对FamilyShowLib项目的引用是存在的 - 我甚至构建了DLL并将其添加到主项目中。这解决了一些其他小错误,但就是这样。我还必须重新添加对PresentationCore,PresentationFramework和WindowsBase的引用。现在我只是坚持以上。
所以我用Google搜索并发现VS中的XAML设计器不起作用的事实。这看起来很奇怪,但也许这就是问题所在。
我如何让这个工作,所以我可以真正学习WPF?!?!?
答案 0 :(得分:2)
我不确定您通过Google找到了什么,但VS 2010 XAML设计师确实有效。您获得的错误表明您缺少对包含Microsoft.FamilyShow
命名空间的程序集的引用。
检查您的References文件夹,确保列出的所有参考文件都没有黄色爆炸,表示缺少装配。在尝试查看设计器之前,您可能还需要构建项目。
更新:
我下载了项目并转换到了VS 2010.由于一些构建警告,我不得不手动设置Familylib项目以编译为.NET 3.0(右键单击项目,打开属性)。然后构建的项目没有错误,我能够在设计器中查看MainWindow.xaml。