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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:23:28+00:00 2026-06-10T08:23:28+00:00

I cannot to synchronize WPF animation of the position and size at the same

  • 0

I cannot to synchronize WPF animation of the position and size at the same time.

Please have a look at my code and let me know if something is wrong there.

Thank you!

 void AnimatePlugin(double fromTop, double toTop, double fromLeft, double toLeft,
            double fromH, double toH, double fromW, double toW, UIElement control)
        {
            Storyboard sb = new Storyboard();

            #region Top

            DoubleAnimation daTop = new DoubleAnimation();
            daTop.From = fromTop;
            daTop.To = toTop;
            daTop.Duration = new Duration(TimeSpan.FromSeconds(1));
            sb.Children.Add(daTop);
            Storyboard.SetTargetProperty(daTop, new PropertyPath("(Canvas.Top)"));
            Storyboard.SetTarget(daTop, control);
            #endregion

            #region Left

            DoubleAnimation daLeft = new DoubleAnimation();
            daLeft.From = fromLeft;
            daLeft.To = toLeft;
            daLeft.Duration = new Duration(TimeSpan.FromSeconds(1));
            sb.Children.Add(daLeft);
            Storyboard.SetTargetProperty(daLeft, new PropertyPath("(Canvas.Left)"));
            Storyboard.SetTarget(daLeft, control);
            #endregion

            #region Heigh

            DoubleAnimation daH = new DoubleAnimation();
            daH.From = fromH;
            daH.To = toH;
            daH.Duration = new Duration(TimeSpan.FromSeconds(1));
            sb.Children.Add(daH);
            Storyboard.SetTargetProperty(daH, new PropertyPath("(Canvas.Height)"));
            Storyboard.SetTarget(daH, control);
            #endregion

            #region Width

            DoubleAnimation daW = new DoubleAnimation();
            daW.From = fromW;
            daW.To = toW;
            daW.Duration = new Duration(TimeSpan.FromSeconds(1));
            sb.Children.Add(daW);
            Storyboard.SetTargetProperty(daW, new PropertyPath("(Canvas.Width)"));
            Storyboard.SetTarget(daW, control);
            #endregion

            sb.Completed += (w, r) => { control.UpdateLayout(); };
            sb.Begin();
        }
  • 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-10T08:23:30+00:00Added an answer on June 10, 2026 at 8:23 am

    Only Canvas.Left and and Canvas.Top are attached properties….(and you are specifying them correctly with brackets).

    However, “Width” and “Height” are not attached properties they are base properties of FrameworkElement……just use PropertyPath("Width") and PropertyPath("Height")

    Instead of using a string to specify the path to the property, you can use the PropertyPath that takes a DependencyProperty type…..so use PropertyPath(Canvas.TopProperty), PropertyPath(Canvas.LeftProperty), PropertyPath(Canvas.WidthProperty), PropertyPath(Canvas.HeightProperty).

    This way you don’t need to worry yourself with using the correct syntax for the PropertyPath string, which is different depending on if the property is attached or not.

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

Sidebar

Related Questions

Dictionary cannot have two values with same key. please tell which logic/algorithm being used
I am trying to synchronize the horizontal scroll position of 2 WPF DataGrid controls.
Cannot dump Stack Overflow XML file into SQL Server 2008. Could you please explain
I know that work items are grouped into the work groups, and you cannot
I have a WPF application implemented using the MVVM framework that uses an ActiveX
I have two processes which I am to synchronize. Process A is running as
The below code does not work in 'real time'. The intention is, when the
I am using in my code at the moment a ReentrantReadWriteLock to synchronize access
Is the following code set up to correctly synchronize the calls on synchronizedMap ?
I need to synchronize time between two or more android devices. But I don't

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.