示例#1
0
        private void StartStoryboard(StackPanel PART_StackPanel)
        {
            Storyboard storyBoard = new Storyboard();

            ThicknessAnimation animation = new ThicknessAnimation();

            animation.From     = new Thickness(-30, 0, 0, 0);
            animation.To       = new Thickness(-10, 0, 0, 0);
            animation.Duration = new Duration(new TimeSpan(1000));

            storyBoard.Children.Add(animation);
            storyBoard.RepeatBehavior = RepeatBehavior.Forever;
            Storyboard.SetTargetName(animation, PART_StackPanel.Name);
            Storyboard.SetTargetProperty(animation, new PropertyPath(StackPanel.MarginProperty));

            PART_StackPanel.BeginStoryboard(storyBoard);
        }