The task is to make the "Heartbeat Effect" when changing the text (the numbers of the beat frequency change).

Those. the figure has changed, the picture of the heart has made a knock.

I watched the original program through snoop, you can see that a trigger and 2 pictures of the heart are registered, which, when changing the text, quickly replace each other.

Tell me how to correctly register this trigger.

Thank you in advance.

  • Looked through snoop in more detail, saw that this action is done via DataTrigger with Binding` - Mac2k8
  • <DoubleAnimation Storyboard.TargetName = "transpStop" Storyboard.TargetProperty = "Offset" From = "0" To = "1" Duration = "0: 0: 0.03" BeginTime = "0: 0: 0.03" /> </ Storyboard> </ BeginStoryboard> </EventTrigger.Actions> </ EventTrigger> </UserControl.Triggers> And actually, what should be on the images: <Image HorizontalAlignment = "Left" Margin = "18,32.002,0,22.011" Width = " 64.175 "Source =" 2.png "x: Name =" first "/> - Mac2k8
  • <Image HorizontalAlignment = "Left" Margin = "18,32.002,0,22.011" Width = "64.175" Source = "1.png"> <Image.OpacityMask> <LinearGradientBrush StartPoint = "0.0" EndPoint = "1, 0 "> <GradientStop x: Name =" transpStop "Offset =" 0 "Color =" Transparent "/> <GradientStop x: Name =" blackStop "Offset =" 0 "Color =" Black "/> </ LinearGradientBrush> < /Image.OpacityMask> </ Image> - Mac2k8

1 answer 1

The decision from the topiastera of comments:

If someone needed, decided the question as follows: Prescribed Event

<UserControl.Triggers> <EventTrigger RoutedEvent="Binding.TargetUpdated"> <EventTrigger.Actions> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetName="blackStop" Storyboard.TargetProperty="Offset" From="0" To="1" Duration="0:0:0.03" /> <DoubleAnimation Storyboard.TargetName="transpStop" Storyboard.TargetProperty="Offset" From="0" To="1" Duration="0:0:0.03" BeginTime="0:0:0.03" /> </Storyboard> </BeginStoryboard> </EventTrigger.Actions> </EventTrigger> </UserControl.Triggers> 

And actually, what should be on the images:

 <Image HorizontalAlignment="Left" Margin="18,32.002,0,22.011" Width="64.175" Source="2.png" x:Name="first"/> <Image HorizontalAlignment="Left" Margin="18,32.002,0,22.011" Width="64.175" Source="1.png" > <Image.OpacityMask> <LinearGradientBrush StartPoint="0,0" EndPoint="1,0"> <GradientStop x:Name="transpStop" Offset="0" Color="Transparent" /> <GradientStop x:Name="blackStop" Offset="0" Color="Black" /> </LinearGradientBrush> </Image.OpacityMask> </Image>