You are right, as each Visual
can have only one parent and since you have only one Path
then last time it's used it will be put in that place of visual tree. What you can do is create Geometry
resource:
<Window.Resources>
<!-- ..... -->
<Geometry x:Key="myPath">M 20,4 L 36,20 L 32,24 L 23,15 L 23,33 L 17,33 L 17,15 L 8,24 L 4,20 Z</Geometry>
</Window.Resources>
and then you can use is in more then one Path
:
<Grid ...>
<Ellipse Height="40" Width="40">
<Ellipse.Fill>
<RadialGradientBrush GradientOrigin="0.3,0.3" Center="0.4,0.4">
<GradientStop Color="White" Offset="0"/>
<GradientStop Color="Black" Offset="1"/>
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Path Stroke="DarkGray" StrokeThickness="1" Data="{StaticResource myPath}">
<Path.Fill>
<RadialGradientBrush GradientOrigin="0.15,0.2" Center="0.3,0.4">
<GradientStop Color="White" Offset="0"/>
<GradientStop Color="Black" Offset="1"/>
</RadialGradientBrush>
</Path.Fill>
</Path>
</Grid>
However, since it's used in more then one place and it basically looks the same, only colours change, it would be useful to create custom UserControl
with 2 DependancyProperty
for colours binding and then you can reuse it as many places you like