首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >App.xaml中的合并字典

App.xaml中的合并字典
EN

Stack Overflow用户
提问于 2014-11-30 16:03:40
回答 1查看 7.5K关注 0票数 4

在分离的.xaml中有一堆Xaml矢量图标。我使用以下指令将它们加载到我的window中:

代码语言:javascript
复制
<Window.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/ScreenToGif;component/Themes/IconSet.xaml"></ResourceDictionary>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Window.Resources>

我有很多窗口,所以我想简单地把这段代码放在App.xaml中。

我在尝试这个:

代码语言:javascript
复制
<Application.Resources> <!-- Error, The property "Resources" can only be set once. -->
    <ResourceDictionary x:Key="IconSet"> <!--Not sure why this?-->
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/Mine;component/Themes/Theme.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>

<!--Here goes the rest of the file, with Style and DropShadowEffect... -->
</Application.Resources>

这就是问题所在:

所有示例都没有使用x:Key属性,但它给出了一个错误,说明我需要。当我这么做的时候,它说我不能有多个属性Resource.

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-11-30 16:42:31

请参阅评论文本

代码语言:javascript
复制
<Application.Resources>    
    <ResourceDictionary>           
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/Mine;component/Themes/Theme.xaml"/>
        </ResourceDictionary.MergedDictionaries>

        <!--You have to add other style here only-->

    </ResourceDictionary>

<!--Not Here-->

</Application.Resources>

票数 22
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27215155

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档