位置とサイズのWPFアニメーションを同時に同期することはできません。
私のコードを見て、そこに何か問題があるかどうか教えてください。
ありがとうございました!
void AnimatePlugin(double fromTop, double toTop, double fromLeft, double toLeft,
double fromH, double toH, double fromW, double toW, UIElement control)
{
Storyboard sb = new Storyboard();
#region Top
DoubleAnimation daTop = new DoubleAnimation();
daTop.From = fromTop;
daTop.To = toTop;
daTop.Duration = new Duration(TimeSpan.FromSeconds(1));
sb.Children.Add(daTop);
Storyboard.SetTargetProperty(daTop, new PropertyPath("(Canvas.Top)"));
Storyboard.SetTarget(daTop, control);
#endregion
#region Left
DoubleAnimation daLeft = new DoubleAnimation();
daLeft.From = fromLeft;
daLeft.To = toLeft;
daLeft.Duration = new Duration(TimeSpan.FromSeconds(1));
sb.Children.Add(daLeft);
Storyboard.SetTargetProperty(daLeft, new PropertyPath("(Canvas.Left)"));
Storyboard.SetTarget(daLeft, control);
#endregion
#region Heigh
DoubleAnimation daH = new DoubleAnimation();
daH.From = fromH;
daH.To = toH;
daH.Duration = new Duration(TimeSpan.FromSeconds(1));
sb.Children.Add(daH);
Storyboard.SetTargetProperty(daH, new PropertyPath("(Canvas.Height)"));
Storyboard.SetTarget(daH, control);
#endregion
#region Width
DoubleAnimation daW = new DoubleAnimation();
daW.From = fromW;
daW.To = toW;
daW.Duration = new Duration(TimeSpan.FromSeconds(1));
sb.Children.Add(daW);
Storyboard.SetTargetProperty(daW, new PropertyPath("(Canvas.Width)"));
Storyboard.SetTarget(daW, control);
#endregion
sb.Completed += (w, r) => { control.UpdateLayout(); };
sb.Begin();
}