kaycee
kaycee

Reputation: 1309

wpf resource is not found but still applied

I'm having several projects in my solution which contain their own resources. I make sure they are defined in main App.xaml:

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
           <ResourceDictionary Source="pack://application:,,,/MainMenu;component/Resources/Resources.xaml" />
           <ResourceDictionary Source="pack://application:,,,/Main;component/Resources/Resources.xaml" />
    </ResourceDictionary.MergedDictionaries>

the content in each Resources.xaml is applied. but in the designer when I'm using them they appear with error:

<TextBlock
    Style="{StaticResource MainWindowTitleStyle}" />

The resource "MainWindowTitleStyle" could not be resolved.

how can I avoid these errors ?

Upvotes: 1

Views: 1776

Answers (1)

Stewbob
Stewbob

Reputation: 16899

There are stil some problems in the VS 2012 Designer, and this is one of them.

You can change your StaticResource references to DynamicResource and this should prevent the designer from throwing these design-time-only exceptions.

Upvotes: 1

Related Questions