0

我有一个 TextBox(toAnimate) 和一个 Button(toClick)。当我单击按钮时,文本框消失。但它应该在 X Position 20 单位上移动。

我做错了什么?

//double left = Canvas.GetLeft(toAnimate); Returned wrong value.
TranslateTransform tanl = new TranslateTransform();
Vector pos = VisualTreeHelper.GetOffset(toAnimate);
double left = pos.X;
toAnimate.RenderTransform = tanl;
DoubleAnimation doua = new DoubleAnimation((left + 20), left, TimeSpan.FromSeconds(3));
tanl.BeginAnimation(TranslateTransform.XProperty, doua);
4

0 回答 0