public AnimatorHelperBase GetContinuumAnimation(FrameworkElement element, AnimationType animationType) { TextBlock nameText; if (element is TextBlock) nameText = element as TextBlock; else nameText = element.GetVisualDescendants().OfType<TextBlock>().FirstOrDefault(); if (nameText != null) { if (animationType == AnimationType.NavigateForwardIn) { return new ContinuumForwardInAnimator() { RootElement = nameText, LayoutRoot = AnimationContext }; } if (animationType == AnimationType.NavigateForwardOut) { return new ContinuumForwardOutAnimator() { RootElement = nameText, LayoutRoot = AnimationContext }; } if (animationType == AnimationType.NavigateBackwardIn) { return new ContinuumBackwardInAnimator() { RootElement = nameText, LayoutRoot = AnimationContext }; } if (animationType == AnimationType.NavigateBackwardOut) { return new ContinuumBackwardOutAnimator() { RootElement = nameText, LayoutRoot = AnimationContext }; } } return null; }
private static List<DependencyObject> GetEffectiveItems(FrameworkElement container) { var effectiveElements = container .GetVisualDescendants() .Where(e => GetIsElement(e) && IsActiveElement(e, container)) .ToList(); return effectiveElements; }