Class library does not recognize CommandManager class

随声附和 提交于 2019-12-01 02:11:10

Go to the "References" part of your class library and select "Add Reference". Look for an assembly called "PresentationCore" and add it.

Then in your class file add the using statement using System.Windows.Input;

You will then be able to access the CommandManager as you expect.

Just adding: lots of guys when they go to create a class library, they select "WPF Custom Control Library" and then erase the "Class1.cs" file. It's a shortcut that automatically adds the right namespaces to your library. Whether it's a good or bad shortcut is anybody's call, but I use it all the time.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!