命名空间'System.Windows'中不存在类型或命名空间名称'Window'

Joe*_*jr2 2 c# wpf extension-methods namespaces

我正在尝试为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)
        { 
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

当我尝试编译它时,我收到以下错误:

命名空间'System.Windows'中不存在类型或命名空间名称'Window'

是的,我在我的类库项目中添加了对System.Windows和System.Windows.Forms的引用,它们显示在解决方案资源管理器中项目的引用下.

我究竟做错了什么?

Car*_*ras 5

添加PresentationFramework.dll对包含System.Windows命名空间的项目的引用.

http://msdn.microsoft.com/es-es/library/system.windows.window(v=vs.110).aspx