my requirement is I want to set blink effect on button2 when button1 is clicked. I did refer this example for blinking effect on textblock.
Blinking TextBlock?
but its not working for my button2. I can show you xaml code if you want. plz help me out. Thanks.
Try this:
<Button Name="button1" Margin="10" Content="Animate Button2!">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard BeginTime="00:00:00"
RepeatBehavior="Forever"
Storyboard.TargetName="button2"
Storyboard.TargetProperty="(Foreground).(SolidColorBrush.Color)">
<ColorAnimation From="Black" To="Red" Duration="0:0:1"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Button.Triggers>
</Button>
<Button Name="button2" Margin="10" Content="I will get animated!"></Button>
In case you want to animate the Background: This is not that easy to achieve as the framework is using the background for internal stuff, e.g. the hover animation.
See Blinking button on WPF application
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With