我需要某種方式的sb.Completed
內通過double fromH, double toH, UIElement control
到AnimateH
方法,但我得到了錯誤名稱「拖」不存在當前上下文問題存在
名稱「拖」不在當前情況下存在問題
和等。
我要如何解決?
謝謝!
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();
}
哦,該死的!正確!謝謝!! –