Не удается получить анимацию вершины поля в WPF - PullRequest
0 голосов
/ 01 февраля 2019

У меня есть StackPanel с именем MainStack.Я пытаюсь переместить стековую панель вертикально вниз, анимируя ее свойство top на полях с помощью ThicknessAnimation.Я, честно говоря, понятия не имею, почему мой код ничего не делает.любая помощь будет оценена.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Media.Animation;

namespace casino
{

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
    }

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        ThicknessAnimation myThicknessAnimation = new ThicknessAnimation();
        myThicknessAnimation.Duration = TimeSpan.FromSeconds(5);
        myThicknessAnimation.FillBehavior = FillBehavior.HoldEnd;


        myThicknessAnimation.From = new Thickness(20, 20, 0, 0);
        myThicknessAnimation.To = new Thickness(20, 200, 0, 0);


        Storyboard.SetTargetName(myThicknessAnimation, "MainStack");
        Storyboard.SetTargetProperty(
            myThicknessAnimation, new 
            PropertyPath(Border.BorderThicknessProperty));

        Storyboard ellipseStoryboard = new Storyboard();
        ellipseStoryboard.Children.Add(myThicknessAnimation);

    }
}
}
...