Cambia una imagen durante la animación usando storyboard.
Estaba buscando una manera de cambiar unaImagen durante un guión gráfico, o más específicamente, cambiar elSource
Propiedad de la imagen para apuntar a un nuevo recurso de imagen. Parece que hay unaStringAnimationUsingKeyFrames
y unDiscreteStringKeyFrame
pero esto no funciona (por lo que puedo decir) ya que la propiedad Fuente de la Imagen es de tipoImageSource
Mi guión gráfico actual se ve así
<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>
y la imagen
<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>
Puedo cambiar elSource
de la imagen como parte del guión gráfico o estoy fuera de suerte?