Не работает анимация на созданном компоненте (WPF)

Регистрация свойств зависимости

static ArrowLine()
    {
        X1Property =
        System.Windows.DependencyProperty.Register(
        "X1",
        typeof(double),
        typeof(ArrowLine),
        new UIPropertyMetadata(0.0, new PropertyChangedCallback(OnX1PropertyChanged)),
        new ValidateValueCallback(ValidateDoubleValue)
        );

и так далее (X2,Y1,Y2). Анимация свойств x2,y2 компонента ArrowLine:

DoubleAnimation daX = new DoubleAnimation(Canvas.GetLeft(firstPeak.El) + PeakWidth / 2, Canvas.GetLeft(secondPeak.El) + PeakWidth / 2, TimeSpan.FromSeconds(0.3));
DoubleAnimation daY = new DoubleAnimation(Canvas.GetTop(firstPeak.El) + PeakWidth / 2, Canvas.GetTop(secondPeak.El) + PeakWidth / 2, TimeSpan.FromSeconds(0.3));
ArrowLine ar = new ArrowLine();
ar.X1 = Canvas.GetLeft(firstPeak.El) + PeakWidth / 2;
ar.Y1 = Canvas.GetTop(firstPeak.El) + PeakWidth / 2;
ar.Stroke = Brushes.Green;
ar.StrokeThickness = 4;
canv.Children.Add(ar);
ar.BeginAnimation(ArrowLine.X2Property, daX);
ar.BeginAnimation(ArrowLine.Y2Property, daY);

Проект на github - https://github.com/gek7/GraphTheory (Там функция AddNewRelation)


Ответы (0 шт):