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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:11:03+00:00 2026-06-02T04:11:03+00:00

I want to replace WPF Storyboard with some custom WHILE loop to check if

  • 0

I want to replace WPF Storyboard with some custom WHILE loop to check if it is possible. The code I have is the following one.

public void RestartAnimation(int seconds)
{
            da.From = this.ActualWidth; 
            da.To = -ContentActualWidth; 
            da.RepeatBehavior = RepeatBehavior.Forever;
            da.Duration = new Duration(TimeSpan.FromSeconds(seconds));
            Timeline.SetDesiredFrameRate(da, 15);

            if (sb.Children.Count == 0)
            {
                sb.Children.Add(da);
                Storyboard.SetTargetProperty(da, new PropertyPath("(Canvas.Left)"));
                Storyboard.SetTarget(da, cp);
                sb.Begin();
            }
}

I guess it should be some Timer & WHILE inside of it…

Any clue how it could be done?

Thanks!!

  • 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-06-02T04:11:04+00:00Added an answer on June 2, 2026 at 4:11 am

    I would say, don’t use a while or any other loop, since then you will freeze your program while the Loop is running.
    The simplest way (not necessarily the best) would be to set up a timer which executes once or so per frame so 30-120 times a sec and incrementally do your animation detecting how much real time has actually passed in between the timer calls.

    So if you need to move an object with the speed of 10 units per second, and your timer executes on some fast interval, I would find the time when the last timer call was made, the present time, find the dT(Time Change), and do dT*10, move the object that number of units.

    As the timer iterates, you should see the object move with out freezing your software.

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

Sidebar

Related Questions

i have the following code.My table is called 'tableu'.I want replace 'tableu' with a
I have this code, and I want to know, if I can replace only
I want to produce some library code that will be included into WPF applications.
I want replace a(or each) element(number) instead another element(number) in a class while running
I have a WPF application that contains some Window s with few UserControl s
I know it might be silly, I have just started with WPF. I want
I have the following binding in my wpf application xaml: <TextBox Text={Binding Amount, StringFormat=c}
I Want Replace String ':' by '/', I am Using this code to replace
I have a WPF window that I want replaced with another user control on
hello I want replace following phrase: tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-cool.gif with: http://mysite.com/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-cool.gif I have tried : $comments

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.