private void RemoveRecursive(int index) { if (index >= 0) { if (canAnimate && ExitAnimation != null) { var innerItemsControlItem = innerItemsControl.Items[index]; var oldContent = TreeHelper.FindChild <ContentPresenter>(innerItemsControl, index); if (oldContent is FrameworkElement) { var oldElement = oldContent as FrameworkElement; ExitAnimation.BeginAnimation(oldElement, () => { // remove RemoveItem(index); RemoveRecursive(index - 1); }); } else { RemoveItem(index); RemoveRecursive(index - 1); } } else { RemoveItem(index); RemoveRecursive(index - 1); } } else { DequeueActionInternal(); } }
private void SetExitAnimationResource() { if (ExitAnimation != null) { if (this.mainGrid.Resources.Contains(ExitAnimation)) { this.mainGrid.Resources.Remove(ExitAnimationStoryboardName); } var animationClone = ExitAnimation.Clone(); this.mainGrid.Resources[ExitAnimationStoryboardName] = animationClone; } }