I need to create a several styles that represent different point objects that all do the same thing. To be more specific, it is a bunch of ESRI MarkerSymbols that can either be a Circle, Square, Star, etc but that is probably not relevant to the specific problem.
Each point will behave exactly the same way when the user hovers or clicks on them - this is done through the Visual State Groups like so (I deleted several of the animations to save space:
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="SelectionStates">
<VisualState x:Name="Unselected" />
<VisualState x:Name="Selected">
<Storyboard Storyboard.TargetName="shapeElement">
<DoubleAnimation BeginTime="0:0:0" Duration="0:0:0.5"
Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)"
To="1" />
<DoubleAnimation BeginTime="0:0:0" Duration="0:0:0.5"
Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)"
To="1" />
...................................................................
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<Storyboard Storyboard.TargetName="shapeElement2">
<DoubleAnimation BeginTime="0:0:0" Duration="0:0:0.1"
Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)"
To="1" />
<DoubleAnimation BeginTime="0:0:0" Duration="0:0:0.1"
Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)"
To="1" />
<ObjectAnimationUsingKeyFrames BeginTime="0:0:0.1" Duration="0:0:0"
Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="MouseOver">
<Storyboard Storyboard.TargetName="shapeElement2">
<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0:0:0.01"
Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation BeginTime="00:00:00" Duration="0:0:0.1"
Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)"
To="1.75" />
<DoubleAnimation BeginTime="00:00:00" Duration="0:0:0.1"
Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)"
To="1.75" />
...................................................................
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
Since I want to create several shapes that all will use this collection of Visual State Groups how do I turn it into a resource? In other words, how would I do this:
<esri:MarkerSymbol x:Key="CircleLocationPointMarker" OffsetX="6" OffsetY="6" >
<esri:MarkerSymbol.ControlTemplate>
<ControlTemplate>
<Grid >
<Ellipse x:Name="shapeElement">
..............................................
</Ellipse>
<Ellipse x:Name="shapeElement2">
..............................................
</Ellipse>
<Border x:Name="LocationLabel">
..............................................
</Border>
<VisualStateManager.VisualStateGroups>
---HOW DO I USE A RESOURCE OR SEVERAL RESOURCES??---
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</esri:MarkerSymbol.ControlTemplate>
</esri:MarkerSymbol>
and say another one for a Square and a Star, and so on. Hope that makes sense.