找不到名为“Locator”的资源在 Blend 4、WPF4 的设计时抛出

发布于 2024-09-29 09:35:43 字数 511 浏览 0 评论 0原文

在我正在开发的应用程序中,我有一个主窗口,它分为几个视图。每个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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧竹 2024-10-06 09:35:43

您的问题与此处报告的问题类似:Blend 报告错误,无法找到ViewModelLocator 的键

Your issue appears similar to the one reported here: Blend reports an error that it cannot find the key for ViewModelLocator

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文