Access ResourceDictionary in Windows Phone project from Shared project in App.xaml of Universal 8.1 App

眉间皱痕 提交于 2019-12-06 06:37:59

问题


I am creating a Windows Universal 8.1 app. In the Windows Phone 8.1 project inside I have a certain Xaml file as ResourceDictionary. In the Shared Folder I have the common App.xaml of the 2 projects (Windows and Windows Phone).

Path of ResourceDictionary is: "MyApp.WindowsPhone/Assets/Styles/JumpList.xaml"

In App.xaml I add:

<ResourceDictionary>
   <ResourceDictionary.MergedDictionaries>
           <ResourceDictionary Source="MyApp.WindowsPhone/Assets/Styles/JumpList.xaml"/>
   </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

But I am getting:

An error occured while finding the resource dictionary "MyApp.WindowsPhone/Assets/Styles/JumpList.xaml"

Any idea what's wrong in my Path?


回答1:


Since MyApp.WindowsPhone is the root folder you don't need to specify it you can state it as <ResourceDictionary Source="/Assets/Styles/JumpList.xaml"/>
Usually we declare styles inside a new folder named Styles as Assets folder is meant for adding image files according to norms.

<ResourceDictionary Source="/Styles/JumpList.xaml"/>


来源:https://stackoverflow.com/questions/37253987/access-resourcedictionary-in-windows-phone-project-from-shared-project-in-app-xa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!