Je cherchais un moyen de changer un Image pendant un storyboard, ou plus précisément, changer la propriété Source
de l'image pour pointer vers une nouvelle ressource d'image. Il semble y avoir un StringAnimationUsingKeyFrames
et un DiscreteStringKeyFrame
, mais cela ne fonctionne pas (pour autant que je peux dire) puisque la propriété source de l'image est de type ImageSource
Modifier une image pendant l'animation en utilisant le storyboard
Mon story-board actuelle ressemble à ce
<Storyboard x:Key="TransitionImage">
<DoubleAnimationUsingKeyFrames
BeginTime="00:00:00"
Storyboard.TargetName="image"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
<SplineDoubleKeyFrame KeyTime="00:00:00.7000000" Value="0.2"/>
<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<StringAnimationUsingKeyFrames
BeginTime="00:00:00"
Storyboard.TargetName="image"
Storyboard.TargetProperty="(Image.Source)">
<!-- This does not work -->
<DiscreteStringKeyFrame KeyTime="00:00:00.7000000" Value="check_24.png"/>
</StringAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames
BeginTime="00:00:00"
Storyboard.TargetName="image"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
<SplineDoubleKeyFrame KeyTime="00:00:00.7000000" Value="0.2"/>
<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
et l'image
<Image x:Name="image"
Source="delete_24.png"
Width="32" Height="32"
Margin="8"
RenderTransformOrigin="0.5,0.5">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Image.RenderTransform>
</Image>
Puis-je modifier le Source
de l'image dans le cadre du story-board ou suis-je pas de chance?