If I have some resource defined in resources section of a control or in external resource dictionary, how can I define the same resource with another key? I mean how can I define resource entry that is just reference to another already existing entry?
To be more clear, I want to have several keys referencing one resource just like in programming language I can define several names for one constant. Is it possible?
I've tried that way
<Window.Resources>
<SolidColorBrush x:Key="Brush1" Color="#FFDF7B04"/>
<RadialGradientBrush x:Key="Brush2" GradientOrigin="0.5,0.5" Center="0.5,0.5" RadiusX="0.5" RadiusY="0.5">
<GradientStop Color="#5060FF40" Offset="0" />
<GradientStop Color="#5060FF40" Offset="0.1" />
<GradientStop Color="#3560FF40" Offset="0.4" />
<GradientStop Color="#0860FF40" Offset="0.8" />
<GradientStop Color="#0060FF40" Offset="1" />
</RadialGradientBrush>
<Style x:Key="CustomStyle" TargetType="UserControl">
<Style.Resources>
<StaticResource x:Key="TheBrush" ResourceKey="Brush1"/>
</Style.Resources>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="UserControl">
<Border x:Name="Border" BorderBrush="{StaticResource TheBrush}">
<!-- more content with several usings of {StaticResource TheBrush} -->
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
and it even works in design-time just like I need. But not even compiling.
UPD. To make more sense what I really want: In example above the reason why I need resource TheBrush is if sometimes I will decide to replace appearance of "TheBrush" in my style to another brush (say Brush2), I want to make such replacement in only one place. Withal I can't change definition of "Brush1" because it could be already used in many other controls (actually it could be placed in external resource dictionary and maintained by another person).
UPD 2. I am sorry that because of my poor English, I could not find the answer to my question yourself niether make my question correctly. Thanks to H.B. now I see that the key word of what I want is "alias". I'm looking for a way of aliasing resources, and there are many similar questions:
Alias or Reference in ResourceDictionary
Redefine/alias a resource in WPF?
etc.
So my question is just a duplicate and could be deleted.