Vitalij
Vitalij

Reputation: 4625

PhoneApplicationPage can not resolve StaticResource

At some point Visual Studio (2010) stopped resolving any static Resources (Brushes, Styles, ViewModel locators, etc.) on all PhoneApplicationPage. However any VisualEllement from with a UserControl can see all StaticResources.

Note: All resources worked before and there wasn't any changes to the pages in terms of XAML.

Any ideas why this is happening?

Temp fix: Temporary fix I came up with is to add All resources to PhoneApplicationPage.Resources so before trying to resolve resources at the application level, elements will resolve them from RD of the PhoneApplicationPage.

Edit: All StaticResources are resolved when running in Blend, this issues seems to happen only in VS. Also when creating a new Page in the solution it also can't resolve any StaticResources.

Upvotes: 1

Views: 333

Answers (1)

ZombieSheep
ZombieSheep

Reputation: 29963

There are a couple of things you could try.

  1. Create a new page. Can you access StaticResources from there? If you can, you can narrow down the cause to the xaml for the pages where you are having trouble now. Check the xmlns declarations from the new [age against the old to verify nothing has been accidentally removed, for example.
  2. If you have access to Expression Blend, try opening the solution there and then right-clicking on an element to apply a resource. I have a feeling that the tool might be able to fix issues, but never having seen this behaviour before I can't guarantee it.

Also, are your resources defined in app.xaml, or have you specified another file containing the resources? If the latter, has the plumbing to tie the extra file in gone AWOL somehow?

Upvotes: 1

Related Questions