C#WPF可以解决此代码吗? [英] C# WPF can some one fix this code?

查看:104
本文介绍了C#WPF可以解决此代码吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码

this is my code

public partial class MainWindow : Window
   {
       private Storyboard myStoryboard;
       private Storyboard myStoryboard2;
       public MainWindow()
       {
           InitializeComponent();
           //animation for the hide
           ThicknessAnimation myDoubleAnimation = new ThicknessAnimation();
           myDoubleAnimation.From = (textBlock3.Margin = new Thickness(378, 0, 0, 0));
           myDoubleAnimation.From = (SV.Margin = new Thickness(413, 0, 0, 0));
           myDoubleAnimation.To = (textBlock3.Margin = new Thickness(28, 0, 0, 0));
           myDoubleAnimation.To = (SV.Margin = new Thickness(35, 0, 0, 0));
           myDoubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(0.5));
           myStoryboard = new Storyboard();
           myStoryboard.Children.Add(myDoubleAnimation);
           Storyboard.SetTargetName(myDoubleAnimation, textBlock3.Name);
           Storyboard.SetTargetProperty(myDoubleAnimation, new PropertyPath(Rectangle.MarginProperty));
           //animation for the show
           ThicknessAnimation myDoubleAnimation2 = new ThicknessAnimation();
           myDoubleAnimation2.From = (Margin = new Thickness(28, 0, 0, 0));
           myDoubleAnimation2.To = (Margin = new Thickness(378, 0, 0, 0));
           myDoubleAnimation2.Duration = new Duration(TimeSpan.FromSeconds(0.5));
           myStoryboard2 = new Storyboard();
           myStoryboard2.Children.Add(myDoubleAnimation2);
           Storyboard.SetTargetName(myDoubleAnimation2, textBlock3.Name);
           Storyboard.SetTargetProperty(myDoubleAnimation2, new PropertyPath(Rectangle.MarginProperty));

       }



现在我只希望同时播放2个动画,但是使用此代码,一切都不会动



now i just want 2 animations going at the same time, but with i do this code, nothing moves

推荐答案

不,它不会.我不知道您是否可以一次运行两个情节提要,或者是否需要将它们放在同一情节提要中.我知道您需要启动它.

此处 [ ^ ]
No, it won''t. I a, not sure if you can run two storyboards at once, or if they need to be in the same storyboard. I do know you need to start it.

Here[^]


这篇关于C#WPF可以解决此代码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆