Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

How do I animate Canvas.Left in code?

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 07-20-2007   #1 (permalink)
Jeremy Chaney
Guest


 

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
Guest


 

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
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Animate Min/Max disabling itself, Aero, Vista Ultimate x64 grayprint General Discussion 13 05-07-2008 06:02 AM
Animate Min/Max windows turns itself off Q Vista performance & maintenance 6 02-21-2008 01:31 AM
animate the dialup icon? Jrz Vista General 4 12-13-2007 04:07 PM
How to animate To/From an Auto value? Shawnk Avalon 9 02-15-2007 01:23 PM
Cannot animate a transform in a data template viliescu Avalon 6 01-10-2006 03:52 PM


Vistax64.com 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 2005-2008

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 47 48 49 50 51