Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - How do I animate Canvas.Left in code?

 
 
Old 07-20-2007   #1 (permalink)
Jeremy Chaney


 
 

How do I animate Canvas.Left in code?

I'm trying to animate the position of a button that is a child of a
Canvas control. Run I run my app, though, the control doesn't move. Here
is the code I'm trying:


DoubleAnimation buttonAnimation = new DoubleAnimation();

buttonAnimation.From = currentYValue;
buttonAnimation.To = newYValue;
buttonAnimation.Duration = new Duration(TimeSpan.FromSeconds(1));

myButton.BeginAnimation(Canvas.TopProperty, buttonAnimation);


Any ideas? Is there something wrong with my code? Should I be writing it
a different way?

Thanks,
--Jeremy

My System SpecsSystem Spec
Old 07-21-2007   #2 (permalink)
thelemmings@gmail.com


 
 

Re: How do I animate Canvas.Left in code?

This code should work, what do you use as currentYValue, and
newYValue? From where is this code called?

On Jul 21, 3:05 am, Jeremy Chaney <j...@telestream.net> wrote:
> I'm trying to animate the position of a button that is a child of a
> Canvas control. Run I run my app, though, the control doesn't move. Here
> is the code I'm trying:
>
> DoubleAnimation buttonAnimation = new DoubleAnimation();
>
> buttonAnimation.From = currentYValue;
> buttonAnimation.To = newYValue;
> buttonAnimation.Duration = new Duration(TimeSpan.FromSeconds(1));
>
> myButton.BeginAnimation(Canvas.TopProperty, buttonAnimation);
>
> Any ideas? Is there something wrong with my code? Should I be writing it
> a different way?
>
> Thanks,
> --Jeremy



My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Animate Min/Max windows turns itself off Vista performance & maintenance
animate the dialup icon? Vista General
Q: Tray | Connections -> Animations. Can't get mine to animate??? Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46