I have a custom Button. For some reason, I would like to apply transforms in code behind. And The transforms work fine. But when I try to add animations on the transforms, the animations don't take effect. My code is as below.
    public partial class MyButton : Button
    {
        private TranslateTransform translate = new TranslateTransform() { X = 200, Y = 100 };
        public MyButton()
        {
            InitializeComponent();
            this.RenderTransform = new TransformGroup()
            {
                Children = 
                {
                    this.translate
                }
            };
        }
        protected override void OnClick()
        {
            base.OnClick();
            // Edit: I need to use Storyboard to synchronized animation1 and animation2.
            var sb = new Storyboard();
            var animation1 = new DoubleAnimation(200, -10, new Duration(new TimeSpan(0, 0, 0, 1, 0)));
            Storyboard.SetTarget(animation1, this.translate);
            Storyboard.SetTargetProperty(animation1, new PropertyPath("X"));
            sb.Children.Add(animation1);
            var animation2 = new DoubleAnimation(100, 0, new Duration(new TimeSpan(0, 0, 0, 1, 0)));
            Storyboard.SetTarget(animation2, this.translate);
            Storyboard.SetTargetProperty(animation2, new PropertyPath("Y"));
            sb.Children.Add(animation2);                
            sb.Begin(this);
        }
    }
Could anyone explain why and how to add animations for this scenario?
 
     
    