5

我正在尝试在 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

4

2 回答 2

3

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

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

于 2014-08-12T19:22:43.067 回答
2

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

完成后,执行:

using System.Windows.Controls;

GridViewColumn然后,您可以根据自己的意愿访问所有变量、对象。

System.Windows.Controls.Gridview 

参考资料: GridViewColumn MSDN

命名空间:System.Windows.Controls

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

可能需要在图像上滚动 PresentationFramework 截图

于 2014-08-12T19:07:11.383 回答