C# ResourceReferenceKeyNotFoundException与新的usercontrol

C# ResourceReferenceKeyNotFoundException与新的usercontrol,c#,wpf,C#,Wpf,我正在创建一个使用工具提示图标的小型C应用程序 但是,每当我创建一个新的usercontrol时,都会出现以下错误: System.Windows.ResourceReferenceKeyNotFoundException 'tbNotifyIcon' resource not found. at MS.Internal.Helper.FindResourceHelper.DoTryCatchWhen(Object arg) at System.Windows.Threading.Excepti

我正在创建一个使用工具提示图标的小型C应用程序

但是,每当我创建一个新的usercontrol时,都会出现以下错误:

System.Windows.ResourceReferenceKeyNotFoundException
'tbNotifyIcon' resource not found.
at MS.Internal.Helper.FindResourceHelper.DoTryCatchWhen(Object arg)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args,  Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

tbNotifyIcon是资源目录中的用户控件。代码运行良好,但每次关闭用户控件时,设计器都会因此错误而崩溃。在新的用户控件中,tbNotifyIcon未被使用,但我在设计器中得到了错误。有什么问题吗?

我现在已经解决了这个问题,我想这与Caliburn执行一些我放在构造函数中的代码有关。在从构造函数中删除FindReference代码以定位UI元素后,这个问题就消失了。

你是说它在运行时工作正常?你试过清理和重建这个项目吗?