Xaml不知道在不同的程序集中定义了哪些对象

时间:2012-09-09 04:37:28

标签: xaml

当我在某个非UI程序集中添加一个类并在UI 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中的某处创建了所提及对象的单个实例,那么它就能正常工作。

0 个答案:

没有答案