WeakEventManager

想用一下这个,在学习C# 事件的时候,结果添加了Using System.Windows, WeakEventManager却一直是红色的,无法识别,报这个错哦~

好不容易想用个高大上的弱事件,还找不到命名空间!解决啦!

stackoverflow上找到的答案哦~ 并非原创~ 马克给墙内的小白看~

Severity Code Description Project File Line Suppression State
ErrorCS0246The type or namespace name 'WeakEventManager' could not be found (are you missing a using directive or an assembly reference?)CarSale

用的是VS 2015

如何解决?

1. 点add reference~

【C# 小窍门】WeakEventManager 无法识别!ErrorCS0246The type or namespace name 'WeakEventManager' could not be found-LMLPHP

2. Add reference : WindowBase

【C# 小窍门】WeakEventManager 无法识别!ErrorCS0246The type or namespace name 'WeakEventManager' could not be found-LMLPHP

3. 大功告成啦~

【C# 小窍门】WeakEventManager 无法识别!ErrorCS0246The type or namespace name 'WeakEventManager' could not be found-LMLPHP

04-16 00:43