Reputation: 13610
I've tried the following:
<Image.Resources>
<Storyboard x:Name="LogoStoryBoard">
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Margin" Storyboard.TargetName="LogoImage">
<DiscreteObjectKeyFrame KeyTime="0:0:3" Value="0, 100, 0, 0" />
</ObjectAnimationUsingKeyFrames>
But this only jumps it after 3 seconds. Is there a way I can easy it down a 100 pixels
Upvotes: 0
Views: 454
Reputation: 3506
Need this:
<Image.Resources>
<Storyboard x:Name="LogoStoryBoard">
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Margin" Storyboard.TargetName="LogoImage">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="0, 0, 0, 0" />
<DiscreteObjectKeyFrame KeyTime="0:0:3" Value="0, 100, 0, 0" />
</ObjectAnimationUsingKeyFrames>
Hope its help
Upvotes: 0
Reputation: 932
There is no ThicknessAnimation in WP7/WP8 so you can't animate a margin. Even if you could it would be incredibly laggy since each incremental margin update would require a measure/arrange pass. What you probably want is to give the image a RenderTransform and animate the (TranslateTransform.TranslateY) to get smooth vertical sliding on the compositor. Once the animation completes you can zero the transform and set the margin to update the visual tree as appropriate.
Upvotes: 1
Reputation: 23280
It jumps it at 3 seconds because that's what you have set to on your KeyTime
so if you reduced that to something like "0:0:0.01" then it would be pretty much immediate like;
<ObjectAnimationUsingKeyFrames
Storyboard.TargetProperty="Margin" Storyboard.TargetName="LogoImage">
<DiscreteObjectKeyFrame KeyTime="0:0:0.01" Value="0,100,0,0" />
</ObjectAnimationUsingKeyFrames>
However, you could also just apply a ChangePropertyAction
behavior directly and ditch the storyboard all together. :)
Hope this helps.
Upvotes: 1