Reputation: 38487
I have a Windows 8.1 (WinRT) app and some UI class libraries and am trying to merge ResourceDictionaries into each other to split up my resources better. I have the following three projects with resources:
Framework.UI.Universal (Universal Class Library)
This is the Generic.xaml file contained in a Themes folder in this project:
<ResourceDictionary>
<!-- Contains some resources used by Windows and Windows Phone -->
</ResourceDictionary>
Framework.UI.Windows (Windows Class Library)
This is another of the Generic.xaml file contained in a Themes folder in this project. As you can see I am merging the resource dictionary from the universal project, as well as adding other resources.
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///Framework.UI.Universal/Themes/Generic.xaml"/>
</ResourceDictionary.MergedDictionaries>
<!-- Contains Windows specific resources -->
</ResourceDictionary>
MyApp.Windows (Windows 8.1 App Project)
This is my Windows 8.1 App. I am merging the Windows specific resource dictionary into the App.xaml file, as well as adding app specific resources.
<Application x:Class="CurrencyConverter.Client.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:InfrastructureViews="using:Infrastructure.Client.Views"
RequestedTheme="Light">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///Framework.UI.Windows/Themes/Generic.xaml"/>
</ResourceDictionary.MergedDictionaries>
<!-- Contains Windows app specific resources -->
</ResourceDictionary>
</Application.Resources>
</Application>
In theory this should work but I get an exception on startup with the error message below:
cycle detected in merged resource dictionaries
Upvotes: 0
Views: 1223
Reputation: 38487
Renaming the Generic.xaml in the Universal project to UniversalGeneric.xaml solved the problem. This seems to be a WinRT bug.
Upvotes: 1