示例#1
0
        /// <summary>
        /// The initial collection animation.
        /// </summary>
        /// <param name="itemsControl"> The items control. </param>
        private static void InitCollectionAnimation(ItemsControl itemsControl)
        {
            Wizard     wizard     = itemsControl.FindVisualParent <Wizard>();
            WizardItem wizardItem = itemsControl.FindVisualParent <WizardItem>();

            if ((wizard != null) && (wizardItem != null))
            {
                WizardCollectionAnimation animation = (WizardCollectionAnimation)Enum.Parse(
                    typeof(WizardCollectionAnimation),
                    GetCollectionAnimation(itemsControl).ToString());

                BehaviorCollection            behaviors = Interaction.GetBehaviors(itemsControl);
                AnimatingItemsControlBehavior behavior  = behaviors.OfType <AnimatingItemsControlBehavior>().FirstOrDefault();

                if (behavior == null)
                {
                    behavior = new AnimatingItemsControlBehavior()
                    {
                        Duration = wizard.TransitionDuration.TimeSpan,
                        IsRandom = animation == WizardCollectionAnimation.Random
                    };
                    behaviors.Add(behavior);
                }

                wizardItem.Entering +=
                    (sender, e2) =>
                {
                    behavior.AnimateIn();
                };
                wizardItem.Leaving +=
                    (sender, e2) =>
                {
                    behavior.AnimateOut();
                };
            }
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Behavior = ((Framework.UI.Controls.AnimatingItemsControlBehavior)(target));
                return;

            case 2:

            #line 52 "..\..\..\Views\AnimationView.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OnAnimateIn);

            #line default
            #line hidden
                return;

            case 3:

            #line 55 "..\..\..\Views\AnimationView.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OnAnimateOut);

            #line default
            #line hidden
                return;

            case 4:
                this.Slider = ((System.Windows.Controls.Slider)(target));
                return;

            case 5:
                this.AnimatingItem = ((System.Windows.Controls.Border)(target));
                return;

            case 6:
                this.FadeBehavior = ((Framework.UI.Controls.FadeBehavior)(target));

            #line 100 "..\..\..\Views\AnimationView.xaml"
                this.FadeBehavior.FadeOutCompleted += new System.EventHandler(this.OnFadeOutCompleted);

            #line default
            #line hidden
                return;

            case 7:
                this.SlideBehavior = ((Framework.UI.Controls.SlideBehavior)(target));
                return;

            case 8:

            #line 105 "..\..\..\Views\AnimationView.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OnShow);

            #line default
            #line hidden
                return;

            case 9:

            #line 108 "..\..\..\Views\AnimationView.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OnCollapse);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.Behavior = ((Framework.UI.Controls.AnimatingItemsControlBehavior)(target));
     return;
     case 2:
     
     #line 52 "..\..\..\Views\AnimationView.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OnAnimateIn);
     
     #line default
     #line hidden
     return;
     case 3:
     
     #line 55 "..\..\..\Views\AnimationView.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OnAnimateOut);
     
     #line default
     #line hidden
     return;
     case 4:
     this.Slider = ((System.Windows.Controls.Slider)(target));
     return;
     case 5:
     this.AnimatingItem = ((System.Windows.Controls.Border)(target));
     return;
     case 6:
     this.FadeBehavior = ((Framework.UI.Controls.FadeBehavior)(target));
     
     #line 100 "..\..\..\Views\AnimationView.xaml"
     this.FadeBehavior.FadeOutCompleted += new System.EventHandler(this.OnFadeOutCompleted);
     
     #line default
     #line hidden
     return;
     case 7:
     this.SlideBehavior = ((Framework.UI.Controls.SlideBehavior)(target));
     return;
     case 8:
     
     #line 105 "..\..\..\Views\AnimationView.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OnShow);
     
     #line default
     #line hidden
     return;
     case 9:
     
     #line 108 "..\..\..\Views\AnimationView.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OnCollapse);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }