当我在一些非程序集中添加一个类并在 UIUI
中使用它时,会出现以下错误:xaml
assembly
Provide value on 'System.Windows.StaticResourceExtension' threw an exception.' Line number '22' and line position '55
内部异常:
Could not load file or assembly 'XXX, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.":"XXX, PublicKeyToken=null
堆栈跟踪:
at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at Pouyansoft.SellEngineering.MVVM.WPF.Letters.View.SelectLetterTemplateView.InitializeComponent() in d:\NirooTeamProject\NirooTransTeamProject\SellEngineering\Pouyansoft.SellEngineering.MVVM.WPF.Letters\View\SelectLetterTemplateView.xaml:line 1
at Pouyansoft.SellEngineering.MVVM.WPF.Letters.View.SelectLetterTemplateView..ctor() in D:\NirooTeamProject\NirooTransTeamProject\SellEngineering\Pouyansoft.SellEngineering.MVVM.WPF.Letters\View\SelectLetterTemplateView.xaml.cs:line 23
有趣的是,如果我只是在其中某处创建提到的对象的单个实例,Code Behind
它就可以正常工作。