I have a brush, which is the part ResourceDictionarythat is combined with Application.Resources.
But for some reason it is not allowed at runtime when the style is applied to one of the controls. However, if I call Application.Current.FindResource ("BrushName") from the Immediate window at the time the exception is thrown, the resource will be found.
Am I missing something? Shouldn't WPF try to look for a resource in application resources?
UPDATE The
application is quite large, so I can not publish all the actual code, but here is how to combine and use resources:
Brushes.xaml
<ResourceDictionary ...>
<SolidColorBrush x:Key="BrushName" Color="#12345678" />
</ResourceDictionary>
SomeStyles.xaml
<ResourceDictionary ...>
<Style x:Key="SomeStyle">
<Setter Property="SomeProperty" Value="{StaticResource BrushName}" />
</Style>
</ResourceDictionary>
App.xaml
<Application ...>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Brushes.xaml" />
<ResourceDictionary Source="SomeStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application ...>
And then some control can use the style using a resource like this:
...
Style={StaticResource SomeStyle}
...
UPDATE
, , . , ?