Quantcast
Viewing all articles
Browse latest Browse all 7

Blinking Button Animation

Hi Pete,

Thanks for your response. This animation works fine but I have a further question.  When I click this button, I want to stop the animation (blinking) and want the button to become disable again (after calling my SaveToDB() method).  I used the XAML below to stop the animation on button click (with StopStoryboard) but it is crashing the app:

<Button x:Name="buttonSav" Content="Save" IsEnabled="{Binding Path=DataChanged}" Background="#FFE2E2E2" Click="btnSave_Click"><Button.Style><Style TargetType="Button"><Style.Triggers><DataTrigger Binding="{Binding DataChanged}" Value="true"><DataTrigger.EnterActions><BeginStoryboard x:Name="sb1"><BeginStoryboard.Storyboard><Storyboard AutoReverse="True" RepeatBehavior="Forever"><ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Button.Background).(SolidColorBrush.Color)" ><EasingColorKeyFrame KeyTime="0" Value="Red"/><EasingColorKeyFrame KeyTime="0:0:1" Value="#FF0004FF"><EasingColorKeyFrame.EasingFunction><QuinticEase EasingMode="EaseInOut"/></EasingColorKeyFrame.EasingFunction></EasingColorKeyFrame></ColorAnimationUsingKeyFrames></Storyboard></BeginStoryboard.Storyboard></BeginStoryboard></DataTrigger.EnterActions><DataTrigger.ExitActions><StopStoryboard BeginStoryboardName="sb1"/></DataTrigger.ExitActions></DataTrigger><EventTrigger RoutedEvent="Button.Click"><StopStoryboard BeginStoryboardName="sb1" /></EventTrigger></Style.Triggers></Style></Button.Style></Button>

Thanks.


Viewing all articles
Browse latest Browse all 7

Trending Articles