Basically, neither Visual Studio designer, nor Resharper seem to deal with the StaticResource markup extension when I use it "normally" - without the brackets.
<StaticResource ResourceKey="SomeKey"/>
It's not an issue of finding the resource, it chokes on the property name of 'ResourceKey'. So when designer loads, or if I use Resharper's solution analysis, my error windows are always cluttered with endless instances of "Cannot resolve symbol 'ResourceKey'"
I'm using Silverlight 4 with VS2010, but I had this problem with Silverlight 3 and '08 too. Recentl开发者_如何学Cy reinstalled the whole stack for unrelated reasons, problem remains.
This isn't a showstopper, because everything works fine at runtime and in Blend (and I turn off VS xaml designer anyhow), but it is annoying, and most importantly, puzzling.
Don't know if it's related, but when I mouseover the "StaticResource" it tells me that the class is "ms.internal.metadata.exposedtypes.presentation.staticresourceextension" - but I was pretty sure that it lives in the System.Windows namespace.
Please, overflowers, shed some light on this mystery for me.
I found this resource after a short google. Maybe this will help point you in the right directions. You may find that it is completely irrelivant in which case sorry for wasting your time.
Cannot resolve symbol ResourceKey
It looks like there isn't such class in Silverlight. Citing MSDN's StaticResource Markup Extension page:
In the Silverlight XAML processor implementation, there is no backing class representation. StaticResource is exclusively for use in XAML, using the {} syntax that indicates to a XAML processor that the contents should be treated by a markup extension. The equivalent code would involve querying a discrete ResourceDictionary, using the Contains API.
精彩评论