Is it possible to set a static resource to the same value as another in XAML?

ぃ、小莉子 提交于 2020-01-05 08:24:10

问题


Is it possible to set a static resource to the value of another static resource? As it is possible to reference a static resource from another type of static resource it should be possible, but I can't find out how. I.e something like this:

<!-- My first value -->
<Color x:Key="MyBlueColor">#ff7db3b6</Color>
<!-- This works -->
<SolidColorBrush x:Key="MyBlueColorBrush" Color="{StaticResource MyBlueColor}"/>
<!-- But how do I do this? -->
<Color x:Key="MyOtherNameForBlueColor">{StaticResource BlueColor}</Color>

回答1:


You can do this

<Color x:Key="MyBlueColor">#ff7db3b6</Color>
<StaticResource x:Key="MyOtherNameForBlueColor" ResourceKey="MyBlueColor" />


来源:https://stackoverflow.com/questions/31287625/is-it-possible-to-set-a-static-resource-to-the-same-value-as-another-in-xaml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!