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 4027596
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:06:58+00:00 2026-05-20T11:06:58+00:00

Is there something built in to reset all completed objects’ animations to their pre-animation

  • 0

Is there something built in to reset all completed objects’ animations to their pre-animation values?

What I’m doing is loading a usercontrol in a canvas, which runs a bunch of animations when added. Later, I remove the usercontrol (Canvas.Children.Clear), but don’t delete it. If I add it back into the canvas again, I want it to appear as if it was re-loaded (i.e. the objects all start from their pre-animated values again and start animating), but the control is not reloading, it’s just showing again.

Like a rectangle is visibility.collapsed and canvas.left = 10 as it’s pre-animation state and visibility.visible and canvas.left = 50 as it’s post animation state. When adding it the canvas, either on load the first time or later just by adding it, I want it to go to it’s pre-animation state.

Is there any straight-forward way to do this?

  • 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-20T11:06:59+00:00Added an answer on May 20, 2026 at 11:06 am

    These animations will be children of one or more Storyboard objects. You need to stop these storyboards in the Unloaded event of the user control.

    What most developers appear to be missing is that a Storyboard without a duration will run indefinitely. This is missed because the results of this indefinite running are often desirable. For example an animation fades out an element, the developer wants it remain faded out. If the timeline to which the animation belongs is stopped the element’s opacity property will snap back to the assigned value prior to the animation starting.

    In your case you also want the Storyboards of your animations to run indefinitely while the Usercontrol is loaded. However to get the effect you desire you need to stop these storyboards in the unloaded event.

    Its easy enough to stop a Storyboard, it has a Stop method. The trick is to get hold of the storyboard. The easiest way it so give the storyboard a x:Name. Now you can do something like this:-

        public MyUserControl()
        {
            InitializeComponent();
            Unloaded += MyUserControl_Unloaded;
    
        }
    
        void MyUserControl_Unloaded(object sender, RoutedEventArgs e)
        {
            LoadedStoryboard.Stop();
        }
    

    where LoadedStoryboard is the value of x:Name for the storyboard that runs the loaded animations.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is there something like API built atop the standard ProcessBuilder for calling system programs?
Hey, is there any built in functions or something like that in php that
Are there any good code profilers/analyzers for Erlang? I need something that can build
Is there something like the Python descriptor protocol implemented in other languages? It seems
Is there something special about Safari for Windows and AJAX? In other words: Are
Is there something like InstallShield that I can use for free?
Is there something like Python's getattr() in C#? I would like to create a
Is there something like a panel that I can use in a MFC application.
is there something like a Quickfix in Eclipse IDE available in VisualStudio 2008? Thanks,
Is there something similar to sprintf() in C#? I would for instance like to

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.