/// <summary> /// Adds a storyboard target to the collection. /// </summary> /// <param name="target">The storyboard target to add to the collection.</param> /// <returns><see langword="true"/> if the target was added to the collection; otherwise, <see langword="false"/>.</returns> public Boolean Add(StoryboardTarget target) { Contract.Require(target, nameof(target)); if (target.Storyboard == Storyboard) { return(false); } if (target.Storyboard != null) { target.Storyboard.Targets.Remove(target); } targets.Add(target); target.Storyboard = Storyboard; Storyboard.RecalculateDuration(); return(true); }
/// <summary> /// Initializes a new instance of the <see cref="StoryboardTargetCollection"/> class. /// </summary> /// <param name="storyboard">The storyboard that owns the collection.</param> internal StoryboardTargetCollection(Storyboard storyboard) { Contract.Require(storyboard, nameof(storyboard)); this.storyboard = storyboard; }