<esri:SimpleRenderer x:Key="MySimpleRendererLines">
<esri:SimpleRenderer.Symbol>
<esri:LineSymbol>
<esri:LineSymbol.ControlTemplate>
<ControlTemplate>
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="MouseOver">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="Element" Storyboard.TargetProperty="(Shape.StrokeThickness)" BeginTime="0" Duration="00:00:00" To="6" />
</Storyboard>
</VisualState>
<VisualState x:Name="Normal">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="Element" Storyboard.TargetProperty="(Shape.StrokeThickness)" BeginTime="0" Duration="00:00:00" To="2" />
</Storyboard>
</VisualState>
<VisualState x:Name="Selected">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="Element" Storyboard.TargetProperty="(Shape.StrokeThickness)" BeginTime="0" Duration="00:00:00" To="6"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Path x:Name="Element" Stroke="Black" StrokeThickness="2" />
</Grid>
</ControlTemplate>
</esri:LineSymbol.ControlTemplate>
</esri:LineSymbol>
</esri:SimpleRenderer.Symbol>
</esri:SimpleRenderer>
I have the above Renderer in my xaml and would like to change the VisualState of a Symbol programmatically like this:
VisualStateManager.GoToState(_MySymbol, "Normal", true);
My problem is, I have not found a way to access the VisualStateManager (so far I can only access the ControlTemplate via SimpleRenderer sr = LayoutRoot.Resources["MySimpleRendererLines"] as SimpleRenderer;
ControlTemplate ct = sr.Symbol.ControlTemplate;
Thanks for your help!