zoukankan      html  css  js  c++  java
  • wpf 动画结束后保留end值,动画结束后会失去绑定,可以在completed事件重新进行绑定

    https://blog.csdn.net/openzpc/article/details/50588063

    动画结束后会失去绑定,可以在completed事件重新进行绑定

    rightToLeftInverseAnimation = new ThicknessAnimation();
    rightToLeftInverseAnimation.From = new Thickness(btnIcon.Margin.Left - menuPanelOriWidth + btnIcon.Width, btnIcon.Margin.Top, btnIcon.Margin.Right, btnIcon.Margin.Bottom);
    rightToLeftInverseAnimation.To = new Thickness(btnIcon.Margin.Left, btnIcon.Margin.Top + btnIcon.Width, btnIcon.Margin.Right, btnIcon.Margin.Bottom);
    rightToLeftInverseAnimation.Duration = TimeSpan.FromMilliseconds(animationTimesMs);
    rightToLeftInverseAnimation.FillBehavior = FillBehavior.Stop;
    rightToLeftInverseAnimation.Completed += new EventHandler((sender, e) =>
    {
    menu.Margin = btnIcon.Margin;
    Binding binding = new Binding();
    binding.Path = new System.Windows.PropertyPath(MarginProperty);
    binding.Mode = BindingMode.OneWay;
    binding.ElementName = "btnIcon";
    binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
    menu.SetBinding(MarginProperty, binding);
    });
    Storyboard.SetTargetName(rightToLeftInverseAnimation, nameof(menu));
    Storyboard.SetTargetProperty(rightToLeftInverseAnimation, new PropertyPath(Panel.MarginProperty));

                if (!hideStoryboard.Children.Contains(rightToLeftInverseAnimation))
                {
                    hideStoryboard.Children.Add(rightToLeftInverseAnimation);
                }
  • 相关阅读:
    WCF
    WCF
    C#
    ASP.NET MVC
    WCF
    关于函数的参数
    关于函数的return
    移动Web开发技巧汇总(转)
    关于reset.css的那些事
    关于iphone自动播放音频和视频问题的解决办法
  • 原文地址:https://www.cnblogs.com/swobble/p/15698874.html
Copyright © 2011-2022 走看看