The current top-hit on WPF ResourceDictionary on Google has a minor error in the usage of WPF’s ResourceDictionary class. Hopefully I can save someone the ten minutes of hate I had while searching for the cause of the strange error the Studio threw at me.
Wrong:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="TextStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
<!-- other styles can appear in the resource dictionary too -->
<Style TargetType="{x:Type Button}"
x:Key="ButtonStyle">
<Setter Property="Background"
Value="#feca00" />
</Style>
</Application.Resources>
Right:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="TextStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- other styles can appear in the resource dictionary too -->
<Style TargetType="{x:Type Button}"
x:Key="ButtonStyle">
<Setter Property="Background"
Value="#feca00" />
</Style>
</ResourceDictionary>
</Application.Resources>
Note the difference in where the additional <Style>s go.