问题
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