我无法在库项目中添加对命名空间system.windows.controls的引用

时间:2021-08-04 21:07:21

I'm trying to add a reference to the namespace System.Windows.Controls in a library project but i can't find it in the list. Does anybody know what is going on? i'm using 4.0. thanks.

我正在尝试在库项目中添加对命名空间System.Windows.Controls的引用,但我无法在列表中找到它。有人知道发生了什么吗?我正在使用4.0。谢谢。

3 个解决方案

#1


15  

You need to learn to distinguish between assembly names and namespaces. They're not in a 1-1 correspondence.

您需要学习区分程序集名称和名称空间。他们不是1-1通信。

If you're wanting to access e.g. System.Windows.Controls.Button, you need to reference the PresentationFramework assembly, which does seem to contain most of the classes documented on MSDN as being in the System.Windows.Controls namespace.

如果你想访问例如System.Windows.Controls.Button,您需要引用PresentationFramework程序集,它似乎包含MSDN上记录的大多数类,在System.Windows.Controls命名空间中。

Multiple assemblies can contribute classes/controls to a single namespace. And there's no requirement that all (or even the majority) of classes from an assembly all reside within a single namespace.

多个程序集可以为单个名称空间提供类/控件。并且不要求程序集中的所有(甚至大多数)类都驻留在单个名称空间中。

#2


0  

If you are using VS 2010: Check you project settings: right click your Project, select "Properties", then select the "Application" tab. If the Dropdown for "Target framework" is ".Net Framework 4 Client Profile" you have to change it to ".net Framework 4".

如果您使用的是VS 2010:检查项目设置:右键单击您的项目,选择“属性”,然后选择“应用程序”选项卡。如果“目标框架”的下拉列表是“.Net Framework 4 Client Profile”,则必须将其更改为“.net Framework 4”。

Edit: I guess the requried assembly is "PresentationFramework.dll" (see msdn class info about Usercontrol). My fault, Ijust thought it would the Client Profile, because I usualy make this error.

编辑:我猜需要的程序集是“PresentationFramework.dll”(请参阅​​有关Usercontrol的msdn类信息)。我的错,我认为它会是客户档案,因为我通常会犯这个错误。

#3


0  

The System.Windows ships with Silverlight toolkit. Hope that helps.

System.Windows附带Silverlight工具包。希望有所帮助。

#1


15  

You need to learn to distinguish between assembly names and namespaces. They're not in a 1-1 correspondence.

您需要学习区分程序集名称和名称空间。他们不是1-1通信。

If you're wanting to access e.g. System.Windows.Controls.Button, you need to reference the PresentationFramework assembly, which does seem to contain most of the classes documented on MSDN as being in the System.Windows.Controls namespace.

如果你想访问例如System.Windows.Controls.Button,您需要引用PresentationFramework程序集,它似乎包含MSDN上记录的大多数类,在System.Windows.Controls命名空间中。

Multiple assemblies can contribute classes/controls to a single namespace. And there's no requirement that all (or even the majority) of classes from an assembly all reside within a single namespace.

多个程序集可以为单个名称空间提供类/控件。并且不要求程序集中的所有(甚至大多数)类都驻留在单个名称空间中。

#2


0  

If you are using VS 2010: Check you project settings: right click your Project, select "Properties", then select the "Application" tab. If the Dropdown for "Target framework" is ".Net Framework 4 Client Profile" you have to change it to ".net Framework 4".

如果您使用的是VS 2010:检查项目设置:右键单击您的项目,选择“属性”,然后选择“应用程序”选项卡。如果“目标框架”的下拉列表是“.Net Framework 4 Client Profile”,则必须将其更改为“.net Framework 4”。

Edit: I guess the requried assembly is "PresentationFramework.dll" (see msdn class info about Usercontrol). My fault, Ijust thought it would the Client Profile, because I usualy make this error.

编辑:我猜需要的程序集是“PresentationFramework.dll”(请参阅​​有关Usercontrol的msdn类信息)。我的错,我认为它会是客户档案,因为我通常会犯这个错误。

#3


0  

The System.Windows ships with Silverlight toolkit. Hope that helps.

System.Windows附带Silverlight工具包。希望有所帮助。