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);
                }
  • 相关阅读:
    324. Wiggle Sort II
    341. Flatten Nested List Iterator
    300. Longest Increasing Subsequence
    72. Edit Distance
    63. Unique Paths II
    221.Maximal Square
    House Robbers. 198 & 213
    [C++] 与比较有关的事情
    218.The Skyline Problem
    41. First Missing Positive
  • 原文地址:https://www.cnblogs.com/swobble/p/15698874.html
Copyright © 2011-2022 走看看