Class library does not recognize CommandManager class Class library does not recognize CommandManager class wpf wpf

Class library does not recognize CommandManager class


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.