Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7430493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:08:58+00:00 2026-05-29T09:08:58+00:00

How to stop an animation so it won’t produce Completed event. Here’s simple example

  • 0

How to stop an animation so it won’t produce Completed event. Here’s simple example

<Window x:Class="WpfApplication5.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="248" Width="318">
    <Grid>
        <Border Width="20" Height="20" Background="Red" MouseEnter="Border_MouseEnter" MouseLeave="Border_MouseLeave" x:Name="border" />
    </Grid>
</Window>

And backing code:

private void Border_MouseEnter(object sender, MouseEventArgs e)
{
    var a = new DoubleAnimation { To = 0, Duration = TimeSpan.FromMilliseconds(4000) };
    a.Completed += (obj, args) => MessageBox.Show("Boom!");
    border.BeginAnimation(Border.OpacityProperty, a);
}

private void Border_MouseLeave(object sender, MouseEventArgs e)
{
    border.BeginAnimation(Border.OpacityProperty, null);
    border.Opacity = 1;
}

If I move mouse out before rectangle becomes white it still will display popup window after some time. How to prevent this? Let’s assume that Border_MouseLeave and Border_MouseEnter methods doesn’t know about each other (they can’t pass animation instance variable to each other).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:08:59+00:00Added an answer on May 29, 2026 at 9:08 am

    you can use this:

    <Border Width="20" Height="20" Background="Red" x:Name="border" >
                    <Border.Triggers>
                        <EventTrigger RoutedEvent="MouseEnter">
                            <BeginStoryboard Name="Ali">
                                <Storyboard>
                                    <DoubleAnimation To="0" Duration="0:0:4" Completed="com" Storyboard.TargetProperty="Opacity"/>
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger>
                        <EventTrigger RoutedEvent="MouseLeave">
                            <StopStoryboard  BeginStoryboardName="Ali"/>
                        </EventTrigger>
                    </Border.Triggers>
                </Border>
    

    and :

    private void com(object sender, EventArgs e)
            {
                MessageBox.Show("boom!");
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to stop an animation and resume later with jQuery? For example, I've this
How I can stop animation on the last frame. Code here: - (void)method{ NSMutableArray
Is it necessary to stop an animation, before animating the element again? For example,
For CAKeyframeAnimation, there are delegates for animation start and animation stop. But I want
I'm wondering how to stop an animation made with jQuery timers. I think I
I want to stop an animation at the last frame, and after that after
I am trying to stop an animation from propagating on a call back of
How can I start and stop image animation using button control? imageView.animationImages = [NSArray
I am trying to stop the animation of my jcarouselled item when the user
Firefox (and other browsers i believe) stop gif animation when you click the Stop

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.