Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How do I animate Canvas.Left in code?

$
0
0
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:


Code Snippet

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

Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>