private void OnItemAddedAnimation_Ended(object sender, AnimationEndedEventArgs e)
        {
            SingleItemAnimationContext context = this.GetAnimationContextForTarget(e.AnimationInfo.Target as RadVirtualizingDataControlItem, true);
            RadAnimation endedAnimation        = sender as RadAnimation;

            this.OnItemAddedAnimationEnded(endedAnimation, context);
        }
Exemple #2
0
        internal override void OnAfterItemRemovedAnimationEnded(SingleItemAnimationContext context)
        {
            double startingOffset = context.AssociatedItem.CurrentOffset;
            double offset         = context.RealizedLength;

            // Apply the aggregated height correction to all affected visual items reamining on the viewport
            for (int i = 0; i < this.owner.realizedItems.Count; i++)
            {
                RadVirtualizingDataControlItem firstItem = this.owner.realizedItems[i];

                if (firstItem.CurrentOffset > startingOffset)
                {
                    if (firstItem.previous == null || (firstItem.previous != null && firstItem.previous.CurrentOffset + this.GetItemLength(firstItem.previous) <= firstItem.CurrentOffset - offset))
                    {
                        this.SetItemOffset(firstItem, firstItem.CurrentOffset - offset);
                    }
                    else
                    {
                        break;
                    }
                }
            }

            this.TranslateRemoveAnimatedItemsWithOffset(startingOffset, -offset);

            if (this.owner.IsLoaded)
            {
                this.ManageLowerViewport(false);
                this.CheckBottomScrollableBounds();
            }
        }
        internal virtual void OnItemRemovedAnimationEnded(RadAnimation animation, SingleItemAnimationContext context)
        {
            // When a remove animation ends we take it from the queue and...
            if (context != null)
            {
                context.AssociatedItem.Visibility = Visibility.Collapsed;
                this.scheduledRemoveAnimations.Remove(context);
            }

            // In case the animated container is already recycled - we hide it. This happens
            // when a single item remove animation has been started, not a batch one.
            if (!this.itemRemovedBatchAnimationScheduled && context != null)
            {
                if (this.realizedItems.Count > 0)
                {
                    this.virtualizationStrategy.OnAfterItemRemovedAnimationEnded(context);
                }
                else
                {
                    this.CleanupAfterCollectionReset();
                }
            }
            else
            {
                if (this.scheduledRemoveAnimations.Count == 0)
                {
                    this.itemRemovedBatchAnimationScheduled = false;
                    this.CleanupAfterCollectionReset();
                    if (this.listSource.Count == 0)
                    {
                        if (this.ItemsSource == null)
                        {
                            this.ClearReycledItems();
                        }
                    }
                    else
                    {
                        this.BalanceVisualSpace();
                    }
                }
            }

            if (this.scheduledRemoveAnimations.Count == 0)
            {
                this.virtualizationStrategy.RecalculateViewportMeasurements();
            }

            if (this.scheduledRemoveAnimations.Count == 0 && !this.IsLoaded)
            {
                this.itemRemovedAnimationCache.Ended -= this.OnItemRemovedAnimation_Ended;
            }

            this.OnItemAnimationEnded(new ItemAnimationEndedEventArgs()
            {
                Animation = animation, RemainingAnimationsCount = this.scheduledRemoveAnimations.Count
            });
        }
 internal void StopAllRemovedAnimations()
 {
     while (this.scheduledRemoveAnimations.Count > 0)
     {
         // Here we do not need to enqueue the top item since the ForceStop method will invoke the RadAnimation.Ended event where
         // this is done.
         SingleItemAnimationContext context = this.scheduledRemoveAnimations[0];
         RadAnimationManager.ForceStop(context.AssociatedItem, this.itemRemovedAnimationCache);
     }
 }
Exemple #5
0
        internal override void OnAfterItemRemovedAnimationEnded(SingleItemAnimationContext context)
        {
            this.ReorderViewportItemsOnItemRemoved(context.RealizedIndex, context.AssociatedItem);

            if (this.owner.IsLoaded)
            {
                this.ManageLowerViewport(false);
                this.CheckBottomScrollableBounds();
            }
        }
        internal virtual void OnItemAddedAnimationEnded(RadAnimation animation, SingleItemAnimationContext context)
        {
            if (context != null)
            {
                this.scheduledAddAnimations.Remove(context);
                context.AssociatedItem.scheduledForBatchAnimation = false;
            }

            if (this.scheduledAddAnimations.Count == 0 && !this.IsLoaded)
            {
                this.itemAddedAnimationCache.Ended -= this.OnItemAddedAnimation_Ended;
            }
            this.OnItemAnimationEnded(new ItemAnimationEndedEventArgs()
            {
                Animation = animation, RemainingAnimationsCount = this.scheduledAddAnimations.Count
            });
        }
Exemple #7
0
        internal override void OnItemRemovedAnimationEnded(RadAnimation animation, SingleItemAnimationContext context)
        {
            base.OnItemRemovedAnimationEnded(animation, context);

            if (this.realizedItems.Count > 0 && this.listSource.Count > 0)
            {
                SingleItemAnimationContext[] animatedItems = this.scheduledRemoveAnimations.ToArray();
                foreach (SingleItemAnimationContext ctxt in animatedItems)
                {
                    if (ctxt.RealizedIndex == 0)
                    {
                        return;
                    }
                }

                this.PositionPullToRefreshIndicator();
            }
        }
        private void OnItemRemovedAnimation_Ended(object sender, AnimationEndedEventArgs e)
        {
            SingleItemAnimationContext endedAnimation = this.GetAnimationContextForTarget(e.AnimationInfo.Target as RadVirtualizingDataControlItem, false);

            this.OnItemRemovedAnimationEnded(sender as RadAnimation, endedAnimation);
        }
 internal virtual void OnAfterItemRemovedAnimationEnded(SingleItemAnimationContext context)
 {
 }