找不到名为“Locator”的资源在 Blend 4、WPF4 的设计时抛出
在我正在开发的应用程序中,我有一个主窗口,它分为几个视图。每个View都是一个UserControl并且有自己的ViewModel。
通过在 UserControl 内设置 DataContext,我可以在 Expression Blend 4 中使用设计时数据。 Ops,忘了说:我正在使用“基本”定位器类,没有 MEF 等。因此,在 UserControl 中我有这样的东西:
DataContext="{Binding MyControl, Source={StaticResource Locator}}"
当我设计 UserControl 本身时,一切都按预期工作,但我无法摆脱包含它的 MainWindow 中引发的一些恼人的异常。
Expression Blend 说:“找不到名为“Locator”的资源。资源名称区分大小写”。当然,这不是真的……
我读到这是一个老问题,现在已经解决了。
那么,有谁知道为什么我会收到此错误?
干杯, 詹卢卡
In the application I am developing, I have a MainWindow, which is divided in several Views. Each View is a UserControl and has its own ViewModel.
By setting a DataContext inside the UserControl, I am able to work in Expression Blend 4 with design-time data. Ops, forgot to say: I am using the "basic" Locator class, no MEF or so. Hence, in the UserControl I have something like this:
DataContext="{Binding MyControl, Source={StaticResource Locator}}"
Everything works as expected when I am designing the UserControl itself, but I am not able to get rid of some annoying exceptions that are raised in the MainWindow that contains it.
Expression Blend is saying: "Cannot find resource named 'Locator'. Resource names are case sensitive". Naturally, that's not true...
I read around that this was an old issue, now resolved.
So, does anyone know why I am getting this error?
Cheers,
Gianluca
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题与此处报告的问题类似:Blend 报告错误,无法找到ViewModelLocator 的键
Your issue appears similar to the one reported here: Blend reports an error that it cannot find the key for ViewModelLocator