我需要以某种方式传递 double fromH, double toH, UIElement control
给 of 中的AnimateH
方法,sb.Completed
但我得到了错误
当前上下文问题中不存在名称“toW”
等等..
我该如何解决?
谢谢!
void AnimateTop(double from, double to, double fromH, double toH, UIElement control)
{
Debug.WriteLine("EFM - AnimateTop - from: " + from.ToString() + " to: " + to.ToString());
Storyboard sb = new Storyboard();
DoubleAnimation da = new DoubleAnimation();
da.From = from;
da.To = to;
da.Duration = new Duration(TimeSpan.FromSeconds(1));
sb.Children.Add(da);
Storyboard.SetTargetProperty(da, new PropertyPath("(Canvas.Top)"));
Storyboard.SetTarget(da, control);
sb.Completed += (w, r) =>
{
AnimateH(fromW, toW, control); // Here is the error
control.UpdateLayout();
};
sb.Begin();
}