xaml – Windows 10 Universal Merged Dictionaries
所以我有一个
Windows通用类库,其中包含一个资源字典,我想与App.xaml中的Windows 10 Universal Application主资源字典合并.
我的App.xaml只是从同一个程序集中合并到我的主资源字典中. <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Styles/Styles.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> 然后从我的主资源字典(Styles / Styles.xaml)中我合并来自同一程序集的其他资源字典.这是我想在另一个程序集的资源字典中合并的地方: <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Fields.xaml"/> <ResourceDictionary Source="DataTemplates.xaml"/> <!--<ResourceDictionary Source="/{AssemblyName};component/Shared.xaml" />--> <!--<ResourceDictionary Source="pack://application:,/{AssemblyName};component/Shared.xaml" />--> <ResourceDictionary Source="ms-appx:///{AssemblyName}/Shared.xaml" /> </ResourceDictionary.MergedDictionaries> 我已经尝试将其添加到我的主资源字典中: <ResourceDictionary Source="/{AssemblyName};component/Shared.xaml" /> 还有这个… <ResourceDictionary Source="ms-appx:///{AssemblyName}/Shared.xaml" /> 基于this article关于Windows 8.x商店应用程序,这似乎应该如何工作.但它仍然无效. 还有这个… <ResourceDictionary Source="pack://application:,/{AssemblyName};component/Shared.xaml" /> (这是WPF的方式,我知道,但我想我还是试一试!) 但似乎没有工作…… 我在应用程序集中的资源字典的构建操作设置为“页面”.这些资源字典在合并中正在使用它: <ResourceDictionary Source="Styles/Styles.xaml"/> 我得到以下神秘错误:
正如Romasz在评论中提到的那样,您需要参考包含样式的项目.然后使用以下代码进行参考.
<Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="ms-appx:///UserControlLibs/Styles.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- 在windows上缺少nodejs npm全局配置
- windows – BATCH |将多个变量回显到文件
- windows – Azure教程 – 如何使用本地blob存储
- WPF:DLL中等效的应用程序资源
- windows – ASSIGN赢得XP命令行输出到变量
- Windows上RabbitMQ配置文件的添加
- Azure包不包括链接的项目dll,甚至与副本本地集
- windows – 如果我调用GlobalLock(),然后无法调用GlobalUnl
- ssh – 如何让Windows上的TortoiseHg(Mercurial)使用由Putt
- 远程桌面服务 – Microsoft远程桌面服务 – Android