Class library does not recognize CommandManager class

后端 未结 1 1708
春和景丽
春和景丽 2021-01-03 21:31

I\'m developing WPF applications and I want to reuse my classes that are the same in all those applications so I can add them as a reference.

In my case I have a cla

1条回答
  •  囚心锁ツ
    2021-01-03 22:03

    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.

    0 讨论(0)
提交回复
热议问题