winrt xaml merged resources

馋奶兔 提交于 2019-11-30 23:46:59

Using merged dictionaries can get a bit tricky if you have dependencies between other merged dictionaries.

When you have multiple application-scope resources the order of the declare is important. They are resolved in the inverse order of the declare, so in your case you should have the order.

<Application.Resources>
<ResourceDictionary >
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Styles1.xaml"/>
        <ResourceDictionary Source="Styles2.xaml"/>
        <ResourceDictionary Source="DefinedValues.xaml"/>

    </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

Also, you may need to reference the other ResourceDictionary in Styles1.xaml. This worked for me in Styles1.xaml.

<ResourceDictionary "...">

  <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="SharedValues.xaml" />
  </ResourceDictionary.MergedDictionaries>

  <Style x:Name="AnotherStyle"
         TargetType="Button">
    <Setter Property="Height"
            Value="{StaticResource SharedValue}" />
  </Style>
</ResourceDictionary>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!