6
我寫了下面的代碼:如何在Storyboard完成後調用方法?
public void name(object sender, RoutedEventArgs e)
{
DoubleAnimation myDoubleAnimation = new DoubleAnimation();
myDoubleAnimation.From = 1.0;
myDoubleAnimation.To = 0.0;
myDoubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(0.2));
sb1 = new Storyboard();
sb1.Children.Add(myDoubleAnimation);
Storyboard.SetTargetName(myDoubleAnimation, one.Name);
Storyboard.SetTargetProperty(myDoubleAnimation, new PropertyPath(Grid.OpacityProperty));
sb1.Begin(this);
if (one.Opacity == 0)
{
Container_one.Children.Remove(one);
}
}
但並不wwork正確。動畫工作正常,但刪除是錯誤的。我如何將Storyboard-End與調用方法結合起來?
Thnaks很多。