gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 18:20:28 25 4
gpt4 key购买 nike

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

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"/>

关于c# - 从 Universal 8.1 App 的 App.xaml 中的共享项目访问 Windows Phone 项目中的 ResourceDictionary,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37253987/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com