IgorP

Hello,

I wrote the following animation and I am wondering, why the Complete event, assigned to Storyboard isn't triggered. The animation works fine, ellipse moves from one position to the other.

public Window1() {

InitializeComponent();

TranslateTransform translate = new TranslateTransform(100, 150);

NameScope.SetNameScope(this, new NameScope());

Ellipse ellipse = new Ellipse();

ellipse.Name = "myEllipse";

ellipse.Fill = Brushes.Blue;

ellipse.Width = 100;

ellipse.Height = 150;

ellipse.RenderTransform = translate;

this.RegisterName("Att", translate);

hotspot.Children.Add(ellipse);

DoubleAnimation dax = new DoubleAnimation();

dax.To = 300;

dax.Duration = new Duration(TimeSpan.FromSeconds(3));

Storyboard.SetTargetName(dax, "Att");

Storyboard.SetTargetProperty(dax, new PropertyPath(TranslateTransform.XProperty));

sb = new Storyboard();

sb.Children.Add(dax);

sb.Begin(hotspot);

sb.Completed +=new EventHandler(sb_Completed);

}



Re: Windows Presentation Foundation (WPF) [Animation] Complete event

lee d

move sb.Completed +=new EventHandler(sb_Completed); before you begin the StoryBoard






Re: Windows Presentation Foundation (WPF) [Animation] Complete event

IgorP

Thanks a lot. It works now.