繁体   English   中英

从Universal 8.1 App的App.xaml中的共享项目访问Windows Phone项目中的ResourceDictionary

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

我正在创建一个Windows Universal 8.1应用程序。 在Windows Phone 8.1项目里面,我有一个特定的Xaml文件作为ResourceDictionary。 在共享文件夹中,我有两个项目的常见App.xaml(Windows和Windows Phone)。

ResourceDictionary的路径是: "MyApp.WindowsPhone/Assets/Styles/JumpList.xaml"

在App.xaml中我添加:

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

但我得到:

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

知道我的路径有什么问题吗?

由于MyApp.WindowsPhone是根文件夹,您不需要指定它,您可以将其声明为<ResourceDictionary Source="/Assets/Styles/JumpList.xaml"/>
通常我们在名为Styles的新文件夹中声明样式,因为Assets文件夹用于根据规范添加图像文件。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM