[英]The type or namespace name 'Deployment' does not exist in the namespace 'System.Windows'
[英]The type or namespace name 'Window' does not exist in the namespace 'System.Windows'
我正在尝试为 WPF Window 类编写扩展方法。 我在我的解决方案中的类库项目中执行此操作,以便我可以在解决方案中的所有项目中使用它。
这是我的代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace ExtensionMethods
{
public static class MyExtensions
{
public static void ResizeToPrimaryScreenWorkingArea(this System.Windows.Window w)
{
}
}
}
当我尝试编译它时,出现以下错误:
命名空间“System.Windows”中不存在类型或命名空间名称“Window”
是的,我确实在我的类库项目中添加了对 System.Windows 和 System.Windows.Forms 的引用,它们显示在解决方案资源管理器中项目中的引用下。
我究竟做错了什么?
向包含System.Windows
命名空间的项目添加PresentationFramework.dll
引用。
http://msdn.microsoft.com/es-es/library/system.windows.window(v=vs.110).aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.