【问题标题】:Getting XAML designer to show design in VS2010让 XAML 设计器在 VS2010 中展示设计
【发布时间】:2010-10-12 14:02:46
【问题描述】:

我开始学习 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?!?!?

【问题讨论】:

    标签: c# wpf visual-studio-2010 xaml


    【解决方案1】:

    我不确定您通过 Google 找到了什么,但 VS 2010 XAML 设计器确实有效。您收到的错误表明您缺少对包含 Microsoft.FamilyShow 命名空间的程序集的引用。

    检查您的 References 文件夹,确保列出的所有引用旁边都没有黄色标记,表示缺少程序集。在尝试查看设计器之前,您可能还需要构建项目。

    更新:

    我下载了项目并转换为 VS 2010。由于一些构建警告,我不得不手动设置 Familylib 项目以编译为 .NET 3.0(右键单击项目,打开属性)。然后项目构建没有错误,我能够在设计器中查看 MainWindow.xaml。

    【讨论】:

    • 没有 Microsoft.FamilyShow 的程序集——它是 XAML 文件的代码隐藏中使用的命名空间。这就是我开始困惑的原因,但我从来没有点击过“构建”……在我这样做之后,它工作得很好。很有趣。
    • Microsoft.FamilyShow 命名空间在 Familylib 项目/程序集中定义。该程序集在您构建之前不存在,因此会出现错误。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多