【问题标题】:c# GridViewColumns missing assembly referencec# GridViewColumns 缺少程序集参考
【发布时间】:2014-10-05 23:15:19
【问题描述】:

我正在尝试在 Visual Studio 2013 .net 4.5 中使用“System.Windows.Controls.GridViewColumn”,但收到此错误:

找不到类型“GridViewColumn”。确认您不是 缺少程序集引用并且所有引用的程序集都有 已建成。

查看我的参考管理器,我在“程序集”选项卡下有此消息:

所有框架程序集都已被引用。请使用 对象浏览器来探索框架中的引用。

浏览时找不到“PresentationFramework.dll”。 这是该课程的 MSDN:http://msdn.microsoft.com/en-us/library/system.windows.controls.gridviewcolumn(v=vs.110).aspx

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

我尝试添加using System.Windows.Controls.GridViewColumn,但收到此错误:

命名空间中不存在类型或命名空间名称Controls System.Windows(您是否缺少程序集引用?)

编辑:

对于WhyCry,当我按照您的建议进行搜索时,我仍然没有得到任何结果。 也许我需要使用不同的 GridView?也许Windows.UI.Xaml.Controls

【问题讨论】:

  • 尝试仅添加:使用 System.Windows.Controls 然后转到您的引用,右键单击并添加引用,在程序集中搜索 System.Windows.Controls 并以这种方式添加。
  • 如果你重建解决方案或退出并重新打开VS怎么办?我知道这些不是最好的解决方案,但有时我发现这样的事情似乎会发生。
  • 你的项目是 WPF 项目吗?
  • 我按照您的建议在参考管理器中搜索了 System.Windows.Controls,但它显示“未找到任何项目。”
  • 我正在输入答案,找到了方法。

标签: c# visual-studio-2013 .net-4.5 assembly-references


【解决方案1】:

好的。因此,在您的解决方案资源管理器中,右键单击References,然后Add Reference。然后确保框架在对话框的左上角突出显示。在右上角的搜索栏中搜索 PresentationFramework。添加演示框架。

完成后,做:

using System.Windows.Controls;

然后,您可以随心所欲地访问所有 GridViewColumn 变量、对象。

System.Windows.Controls.Gridview 

参考资料: GridViewColumn MSDN

命名空间:System.Windows.Controls

程序集:PresentationFramework(在 PresentationFramework.dll 中)

可能需要在图像上滚动

【讨论】:

  • 我仍然没有找到,我在我的问题中添加了一个屏幕截图。感谢您的帮助!
  • 你有什么样的项目?就像当你点击 New Project 时,你选择了什么? @布莱恩
  • 非常感谢您的帮助。原来问题是我的应用程序是 WinRT 而不是 WPF。再次感谢您的帮助!
  • stackoverflow.com/questions/10183294/… 也许这可以提供帮助? @布莱恩
【解决方案2】:

当您创建基于 WinRT 的 Windows 应用商店应用程序时,此 GridViewColumn 控件是 WPF 控件之一。

WPF 和 WinRT 互斥,不能在 Windows Store 应用中使用 WPF 控件。请阅读:Windows 8 Store Applications Vs. WPF Applications

【讨论】:

    猜你喜欢
    • 2018-08-09
    • 1970-01-01
    • 1970-01-01
    • 2020-02-28
    • 1970-01-01
    • 2014-02-16
    • 1970-01-01
    • 2014-01-09
    • 1970-01-01
    相关资源
    最近更新 更多