iv'e got a ToggleButton which includes a polygon on "Checked" State i rotate the Polygon by 90 deg.
The problem is that after the rotation is complete the Polygon pops back to it's initial angle.
my ToggleButton : (Partial template)
<ControlTemplate TargetType="{x:Type ToggleButton}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Unfocused"/>
<VisualState x:Name="Focused"/>
</VisualStateGroup>
<VisualStateGroup x:Name="CommonStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="00:00:00.3"/>
</VisualStateGroup.Transitions>
<VisualState x:Name="MouseOver"/>
<VisualState x:Name="Normal"/>
<VisualState x:Name="Pressed"/>
<VisualState x:Name="Disabled"/>
</VisualStateGroup>
<VisualStateGroup x:Name="CheckStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0" To="Checked">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="regularPolygon">
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="90" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualTransition>
<VisualState x:Name="Indeterminate"/>
<VisualState x:Name="Checked"/>
<VisualState x:Name="Unchecked"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Polygon x:Name="regularPolygon"
Points="5,10 10,5 5,0"
RenderTransformOrigin="0.5,0.5"
Stretch="Fill"
UseLayoutRounding="False">
<Polygon.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform />
<TranslateTransform/>
</TransformGroup>
</Polygon.RenderTransform>
</Polygon>
</ControlTemplate>
do i need to create some alterations so the Polygon keeps it's new Angle ? thanks in advance .
The problem was that i placed the animation inside a transition and not as the state itself