0

Here we go again.

I'm working on this wiggleanimation to a usercontrol, which basically sets the RotateTransform.Angle from 20 to 30, Autoreverse = true, repeatbehavior = Forever, nothing special..

However my transformgroup is located in a usercontrol called Bomb, and my animation is created in my mainwindow.

To begin with i tried something like this which didn't work, however a tutorial said it should work, and it looks alot nicer than the next part..

Storyboard.SetTarget(wiggleAnimation, ((TransformGroup)bomb.RenderTransform).Children[0])))
Storyboard.SetTargetProperty(wiggleAnimation, new PropertyPath("Angle"));

Then i tried this, and this has the effect I was looking for, however the code does not look very nice.

Storyboard.SetTarget(wiggleAnimation, bomb); 
Storyboard.SetTargetProperty(wiggleAnimation, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(RotateTransform.Angle)"));

So can anyone tell me why the top part isn't working. I'm not given an error on the first part of code, it simply just have no effect when I run my program, and i really wanna optimize as much as I can here.

Kind Regards Max

Max Mazur
  • 1,188
  • 1
  • 13
  • 22

0 Answers0