I moved the styles and templates xaml files form my application (.exe) project to a library project (.dll) because I want to use them in multiple applications.
In App.xaml I have:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MyApplication.Common;component/Resources/All.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
In All.xaml (in the Common assembly) :
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Styles.xaml" />
<ResourceDictionary Source="Templates.xaml" />
<ResourceDictionary Source="Converters.xaml" />
</ResourceDictionary.MergedDictionaries>
With this code keyless styles in Styles.xaml aren't applied.
Instead, if I reference them directly in App.xaml, it works :
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MyApplication.Common;component/Resources/Styles.xaml" />
<ResourceDictionary Source="pack://application:,,,/MyApplication.Common;component/Resources/Templates.xaml" />
<ResourceDictionary Source="pack://application:,,,/MyApplication.Common;component/Resources/Converters.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Can anyone explain why it happens ?