I’m having a little problem with Merging dictionaries in my WP7 application, The app contains a lot of pages and the loading time exceeded the market place limit which is 5 seconds, I had to put the majority of the pages and UI stuff in a separate class library to cut off the loading time, the problem is that the pages ware referencing static resources in the global app.xaml, I tried to move the xaml stuff in App.xaml to a separate resource dictionary in the class library project. I also referenced that resource dictionary file in every page.
<phone:PhoneApplicationPage.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources.xaml" />
</ResourceDictionary.MergedDictionaries>
<Converters:TimeSpanToWeekAndDayConverter x:Key="weekAndDayConverter"/>
</ResourceDictionary>
</phone:PhoneApplicationPage.Resources>
The problem is that I always receive this exception :
Failed to assign to property ‘System.Windows.ResourceDictionary.Source’.
I also tried to change the build action of that resource dictionary from Page to Resource to Content (With all their specific path syntax considerations) without any luck.
I hope someone has a idea.
Thanks
I don’t think you need to move the resources – you can keep them in the App resources. It should work.
You need to reference the dictionary by using the full name. In this case:
Source=”/AssemblyName;component/Resources.xaml”
Otherwise, it won’t know how to find it.