我正在尝试在 Visual Studio 2013、.net 4.5 中使用“System.Windows.Controls.GridViewColumn”,但我收到此错误:
The type 'GridViewColumn' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
在我的 Reference Manager 中,我在程序集选项卡下看到了这条消息:
All of the Framework assemblies are already referenced. Please use the Object Browser to explore the references in the Framework.
当我浏览时,我找不到“PresentationFramework.dll”。 这是类(class)的 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
但收到此错误:
The type or namespace name
Controls
does not exist in the namespaceSystem.Windows
(are you missing an assembly reference?)
编辑:
对于 WhyCry,当我按照您的建议进行搜索时,我仍然没有得到任何结果。
也许我需要使用不同的 GridView?也许 Windows.UI.Xaml.Controls
?
最佳答案
当您创建基于 WinRT 的 Windows 商店应用程序时,而此 GridViewColumn 控件是 WPF 控件之一。
WPF 和 WinRT 是互斥的,您不能在 Windows 应用商店应用程序中使用 WPF 控件。请阅读:Windows 8 Store Applications Vs. WPF Applications
关于c# GridViewColumns 缺少程序集引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25271865/