Пример #1
0
            private void SetActionTriggers()
            {
                var width = _slidingPage.ActualWidth;


                EnterActions.Clear();
                ExitActions.Clear();

                var enterStoryboard = new Storyboard();

                var enterMarginAnimation = new ThicknessAnimation(new Thickness(width, 0, -width, 0), new Thickness(0), new Duration(TimeSpan.FromSeconds(.75)))
                {
                    DecelerationRatio = .9
                };

                enterMarginAnimation.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("(FrameworkElement.Margin)"));
                enterStoryboard.Children.Add(enterMarginAnimation);

                var enterOpacityAnimation = new DoubleAnimation(0, 1, new Duration(TimeSpan.FromSeconds(.25)));

                enterOpacityAnimation.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("(UIElement.Opacity)"));
                enterStoryboard.Children.Add(enterOpacityAnimation);

                var enterVisibilityAnimation = new EnterVisibilityAnimation();

                enterStoryboard.Children.Add(enterVisibilityAnimation);

                EnterActions.Add(new BeginStoryboard {
                    Storyboard = enterStoryboard
                });


                var exitStoryboard = new Storyboard();

                var exitMarginAnimation = new ThicknessAnimation(new Thickness(-width, 0, width, 0), new Duration(TimeSpan.FromSeconds(.5)))
                {
                    AccelerationRatio = .9
                };

                exitMarginAnimation.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("(FrameworkElement.Margin)"));
                exitStoryboard.Children.Add(exitMarginAnimation);

                var exitOpacityAnimation = new DoubleAnimation(0, new Duration(TimeSpan.FromSeconds(.5)));

                exitOpacityAnimation.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("(UIElement.Opacity)"));
                exitStoryboard.Children.Add(exitOpacityAnimation);

                var exitVisibilityAnimation = new ExitVisibilityAnimation();

                exitStoryboard.Children.Add(exitVisibilityAnimation);

                ExitActions.Add(new BeginStoryboard {
                    Storyboard = exitStoryboard
                });
            }
Пример #2
0
        public override void DeepCopy(IDeepCopyable source, ICopyManager copyManager)
        {
            base.DeepCopy(source, copyManager);
            TriggerBase tb = (TriggerBase)source;

            foreach (TriggerAction ac in tb.EnterActions)
            {
                EnterActions.Add(copyManager.GetCopy(ac));
            }
            foreach (TriggerAction ac in tb.ExitActions)
            {
                ExitActions.Add(copyManager.GetCopy(ac));
            }
            foreach (Setter s in tb.Setters)
            {
                Setters.Add(copyManager.GetCopy(s));
            }
        }