Reputation: 21
I have a label in canvas. I want to animate the Canvas.Left
of the label, but I don't known how to do it...
DoubleAnimation Label_dx = new DoubleAnimation(150,60, new Duration(new TimeSpan(0, 0, 1)));
label.BeginAnimation(???, Label_dx);
Upvotes: 2
Views: 158
Reputation: 13185
you can also use :
label.BeginAnimation(Canvas.LeftProperty, Label_dx);
or
TranslateTransform trans = new TranslateTransform();
label.RenderTransform = trans;
DoubleAnimation anim = new DoubleAnimation(150,60, new Duration(new TimeSpan(0, 0, 1));
trans.BeginAnimation(TranslateTransform.YProperty, anim);
The TranslateTransform is a specific kind of render transformation. Rather that changing properties of the control (such as the Left property), it simply affects how the control is displayed on the screen
Upvotes: 2