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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:03:43+00:00 2026-06-01T22:03:43+00:00

Is it possible to animate the old school way, in codebehind, instead of xaml?

  • 0

Is it possible to animate the “old school” way, in codebehind, instead of xaml?

I just want an arrow that points to something with a ‘bounce effect’ which I could easily do in my own for loop. But I do not know how to refresh or do a timer delay, inside the loop. I already placed the image into position in codebehind. All I want to do is this simple animation…

public void validationArrow()
{

    var validationArrow = new Image();
    validationArrow.Source = new BitmapImage(new Uri("/SlProject;component/arrow.png", UriKind.RelativeOrAbsolute));
    LayoutRoot.Children.Add(validationArrow);
    validationArrow.Stretch = Stretch.None;
    validationArrow.VerticalAlignment = System.Windows.VerticalAlignment.Top;
    validationArrow.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
    var arrowPosition = new TranslateTransform { X = 0, Y = 0 };
    validationArrow.RenderTransform = arrowPosition;

    validationArrow.Name = "validationArrow";

    for (int i = 150; i >= 0; i--)
    {
        arrowPosition.X = i;
        validationArrow.RenderTransform = arrowPosition;
        // how can I refresh screen and do some timing here?
    }
}
  • 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-01T22:03:44+00:00Added an answer on June 1, 2026 at 10:03 pm

    There’s no school like the old school 😉
    Here, this should help you on your way. You can play with the millisecond and Y translation values being passed to the BuildEasing method to change the ‘bounce’ effect’s speed and distance.

        private void RunStoryboard()
        {
            var arrowImage = new Image();
            arrowImage.RenderTransform = new CompositeTransform();
            arrowImage.Source = new BitmapImage(new Uri("/SlProject;component/arrow.png", UriKind.RelativeOrAbsolute));
            LayoutRoot.Children.Add(arrowImage);
    
            Storyboard storyboard = new Storyboard();
            storyboard.Children.Add(BuildKeyFrame(arrowImage));
            storyboard.Begin();
        }
    
        private DoubleAnimationUsingKeyFrames BuildKeyFrame(Image target)
        {
            DoubleAnimationUsingKeyFrames kf = new DoubleAnimationUsingKeyFrames();
            Storyboard.SetTarget(kf, target);
            Storyboard.SetTargetProperty(kf, new PropertyPath("(UIElement.RenderTransform).(CompositeTransform.TranslateY)"));
    
            kf.KeyFrames.Add(BuildEasing(100, 10));
            kf.KeyFrames.Add(BuildEasing(200, 0));
            kf.KeyFrames.Add(BuildEasing(300, 10));
            kf.KeyFrames.Add(BuildEasing(400, 0));
            kf.KeyFrames.Add(BuildEasing(500, 10));
            kf.KeyFrames.Add(BuildEasing(600, 0));
    
            return kf;
        }
    
        private EasingDoubleKeyFrame BuildEasing(int ms, int value)
        {
            return new EasingDoubleKeyFrame()
            {
                KeyTime = KeyTime.FromTimeSpan(new TimeSpan(0, 0, 0, 0, ms)),
                Value = value
            };
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to animate something that you have drawn using core graphics in
Is it possible to animate a QGraphicsItem in such a way that it would
I am making an old-school 2d game, and I want to animate a specific
Does any one know if its possible to animate app.current.mainwindow.width so that you get
I think I may be trying something that isn't possible. I was recently tasked
Is it possible to animate just the part of the value of textbox/label. For
Is it possible to animate ListView items in C# ? The purpose is that
I was just wondering if it's possible to animate the height of a grid
Is it possible to animate the change of a UIProgressView such that the display
I want to, as properly as possible, animate a view from top to bottom.

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.