private void AnimationCreate(VisualElement element, CarouselPathAnimationData data)
 {
     this.CarouselPath.CreateAnimation(element, data, this.animationFrames, this.animationDelay);
     data.CurrentAnimation.ApplyEasingType = this.easingType;
     if (data.IsOutAnimation())
     {
         data.CurrentAnimation.AnimationFinished += (AnimationFinishedEventHandler)((param0, param1) =>
         {
             CarouselPathAnimationData itemAnimationData = CarouselItemsContainer.GetItemAnimationData((RadObject)element);
             bool interrupt = itemAnimationData.Interrupt;
             CarouselItemsContainer.AnimationRemoveCurrent((RadElement)element, itemAnimationData);
             if (interrupt)
             {
                 return;
             }
             Rectangle boundingRectangle = element.ControlBoundingRectangle;
             int index = this.Children.IndexOf((RadElement)element);
             if (index != -1)
             {
                 this.Children.RemoveAt(index);
             }
             this.ElementTree.Control.Invalidate(boundingRectangle, true);
         });
     }
     else
     {
         data.CurrentAnimation.AnimationFinished += (AnimationFinishedEventHandler)((param0, param1) => CarouselItemsContainer.AnimationRemoveCurrent((RadElement)element, (CarouselPathAnimationData)null));
     }
 }
Beispiel #2
0
        private CarouselPathAnimationData GetItemAnimationData(int index)
        {
            if (this.ElementState != ElementState.Loaded && this.ElementState != ElementState.Constructed)
            {
                return(null);
            }

            return(CarouselItemsContainer.GetItemAnimationData(this.Children[index]));
        }
        private void Animate(VisualElement element)
        {
            CarouselPathAnimationData itemAnimationData = CarouselItemsContainer.GetItemAnimationData((RadObject)element);

            if (!CarouselItemsContainer.AnimationRemoveCurrent((RadElement)element, itemAnimationData))
            {
                return;
            }
            this.AnimationCreate(element, itemAnimationData);
            itemAnimationData.Interrupt = !itemAnimationData.IsOutAnimation();
            if (itemAnimationData.CurrentAnimation == null)
            {
                return;
            }
            itemAnimationData.CurrentAnimation.AnimationStarted  += new AnimationStartedEventHandler(this.CurrentAnimation_AnimationStarted);
            itemAnimationData.CurrentAnimation.AnimationFinished += new AnimationFinishedEventHandler(this.CurrentAnimation_AnimationFinished);
            itemAnimationData.CurrentAnimation.ApplyValue((RadObject)element);
        }
 public CarouselItemsLocationBehavior(CarouselItemsContainer owner)
     : base(CarouselItemsContainer.CarouselLocationProperty)
 {
     this.owner = owner;
 }