I'm trying to use the VisualStateManager to manage my control states. The following works fine and gives me a one second animation between states.
<VisualStateManager.VisualStateGroups>
<VisualStateGroup Name="EditStates">
<!-- Default transition time commented out
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0:0:2"></VisualTransition>
</VisualStateGroup.Transitions>-->
<VisualState Name="Normal">
<Storyboard>
<ThicknessAnimation Storyboard.TargetName="ViewBorder"
Storyboard.TargetProperty="Margin" To="0"/>
<DoubleAnimation Storyboard.TargetName="HeaderTransform"
Storyboard.TargetProperty="ScaleY" To="0" />
</Storyboard>
</VisualState>
<VisualState Name="Editing">
<Storyboard>
<ThicknessAnimation Storyboard.TargetName="ViewBorder"
Storyboard.TargetProperty="Margin" To="100,0,100,100"/>
<DoubleAnimation Storyboard.TargetName="HeaderTransform"
Storyboard.TargetProperty="ScaleY" To="1" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
However, if I uncomment the transition code to try and set a 2 second animation time, it messes up spectacularly.
When "Editing" is set:
- The
DoubleAnimation
snaps to 1 instantly, with no animation. - The
ThicknessAnimation
waits for 2 seconds and then animates over 1 second
When "Normal" is set:
- The
ThicknessAnimation
snaps to 0 instantly, with no animation. - The
DoubleAnimation
waits for 2 seconds and then animates over 1 second.
Can anyone explain what the heck is going on?
I've tried setting Duration="0"
on all animations like certain samples seem to do, but all this does is remove the animation that does work. I still get the 2 second delays, then snapping rather than animating.