protected override void ValidateCore() { base.ValidateCore(); if (this.keyFramesDirty) { this.RebuildKeyFrames(); this.keyFramesDirty = false; this.OnPropertyChanged("HasAnimationVisual"); } this.HasAnimation = false; this.DescendantOnlyHasAnimation = false; foreach (TimelineItem timelineItem in (Collection <TimelineItem>) this.Children) { AnimationTimelineItem animationTimelineItem = timelineItem as AnimationTimelineItem; if (animationTimelineItem != null && animationTimelineItem.IsInActiveTimeline) { this.HasAnimation = true; break; } CompoundKeyFrameTimelineItem frameTimelineItem = timelineItem as CompoundKeyFrameTimelineItem; if (frameTimelineItem != null) { if (!frameTimelineItem.IsCompoundKeyFrameRoot && frameTimelineItem.HasAnimation) { this.HasAnimation = true; break; } if (frameTimelineItem.HasAnimation || frameTimelineItem.DescendantOnlyHasAnimation) { this.DescendantOnlyHasAnimation = true; } } } this.OnPropertyChanged("HasAnimationVisual"); }
public static ScheduledTimelineItem FindItem(TimelineItem parentTimelineItem, StoryboardTimelineSceneNode parentTimeline, PropertyReference targetProperty) { if (targetProperty == null) { return((ScheduledTimelineItem)null); } foreach (TimelineItem timelineItem in (Collection <TimelineItem>)parentTimelineItem.Children) { AnimationTimelineItem animationTimelineItem = timelineItem as AnimationTimelineItem; if (animationTimelineItem != null && animationTimelineItem.parentTimeline == parentTimeline && animationTimelineItem.TargetProperty.Path == targetProperty.Path) { return((ScheduledTimelineItem)animationTimelineItem); } CompoundPropertyTimelineItem propertyTimelineItem = timelineItem as CompoundPropertyTimelineItem; if (propertyTimelineItem != null) { ScheduledTimelineItem scheduledTimelineItem = ScheduledTimelineItem.FindItem((TimelineItem)propertyTimelineItem, parentTimeline, targetProperty); if (scheduledTimelineItem != null) { return(scheduledTimelineItem); } } BehaviorTimelineItem behaviorTimelineItem = timelineItem as BehaviorTimelineItem; if (behaviorTimelineItem != null) { ScheduledTimelineItem scheduledTimelineItem = ScheduledTimelineItem.FindItem((TimelineItem)behaviorTimelineItem, parentTimeline, targetProperty); if (scheduledTimelineItem != null) { return(scheduledTimelineItem); } } EffectTimelineItem effectTimelineItem = timelineItem as EffectTimelineItem; if (effectTimelineItem != null) { ScheduledTimelineItem scheduledTimelineItem = ScheduledTimelineItem.FindItem((TimelineItem)effectTimelineItem, parentTimeline, targetProperty); if (scheduledTimelineItem != null) { return(scheduledTimelineItem); } } } return((ScheduledTimelineItem)null); }