I've put all of my application's ResourceDictionaries into a separate assembly and merged them into one ResourceDictionary which I want to include as a resource in my application:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="InputStyles.xaml"/>
<ResourceDictionary Source="DataGridStyles.xaml"/>
<ResourceDictionary Source="ComboboxStyles.xaml"/>
<ResourceDictionary Source="CheckboxStyles.xaml"/>
<ResourceDictionary Source="TabControlStyles.xaml"/>
<ResourceDictionary Source="ButtonStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Declaring resource:
<Window.Resources>
<ResourceDictionary Source="pack://application:,,,/StyleAssembly;component/Styles.xaml"/>
</Window.Resources>
Looking at the designer in VS all controls are displayed with the styles from the files but when I try to start the application I'm getting the following error:
"Cannot locate resource 'inputstyles.xaml'."
The build action is set to 'Page' for all files and the build for both projects succeeds. What am I doing wrong?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…