Exemplo n.º 1
0
        /// <summary>
        ///     Makes this instance a modifiable deep copy of the specified <see cref="KeyFrameCollection{T}" /> using current
        ///     property values. Resource references, data bindings, and animations are not copied, but their current values are.
        /// </summary>
        /// <param name="sourceFreezable">The <see cref="KeyFrameCollection{T}" /> to clone.</param>
        protected override void GetCurrentValueAsFrozenCore(Freezable sourceFreezable)
        {
            KeyFrameCollection <T> collection = (KeyFrameCollection <T>)sourceFreezable;

            base.GetCurrentValueAsFrozenCore(sourceFreezable);
            int frameCount = collection._keyFrames.Count;

            _keyFrames = new List <KeyFrame <T> >(frameCount);
            for (int i = 0; i < frameCount; ++i)
            {
                KeyFrame <T> frame = (KeyFrame <T>)collection._keyFrames[i].GetCurrentValueAsFrozen();
                _keyFrames.Add(frame);
                OnFreezablePropertyChanged(null, frame);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Makes this instance a deep copy of the specified <see cref="KeyFrameCollection{T}" />. When copying dependency
        ///     properties, this method copies resource references and data bindings (but they might no longer resolve) but not
        ///     animations or their current values.
        /// </summary>
        /// <param name="sourceFreezable">The <see cref="KeyFrameCollection{T}" /> to clone.</param>
        protected override void CloneCore(Freezable sourceFreezable)
        {
            KeyFrameCollection <T> collection = (KeyFrameCollection <T>)sourceFreezable;

            base.CloneCore(sourceFreezable);
            int count = collection._keyFrames.Count;

            _keyFrames = new List <KeyFrame <T> >(count);
            for (int i = 0; i < count; i++)
            {
                KeyFrame <T> keyFrame = (KeyFrame <T>)collection._keyFrames[i].Clone();
                _keyFrames.Add(keyFrame);
                OnFreezablePropertyChanged(null, keyFrame);
            }
        }
 private void CopyCommon(KeyFramesAnimationBase <T> sourceAnimation, bool isCurrentValueClone)
 {
     _areKeyTimesValid = sourceAnimation._areKeyTimesValid;
     if (_areKeyTimesValid && (sourceAnimation._sortedResolvedKeyFrames != null))
     {
         _sortedResolvedKeyFrames = (ResolvedKeyFrameEntry[])sourceAnimation._sortedResolvedKeyFrames.Clone();
     }
     if (sourceAnimation._keyFrames != null)
     {
         if (isCurrentValueClone)
         {
             _keyFrames = (KeyFrameCollection <T>)sourceAnimation._keyFrames.CloneCurrentValue();
         }
         else
         {
             _keyFrames = sourceAnimation._keyFrames.Clone();
         }
         OnFreezablePropertyChanged(null, _keyFrames);
     }
 }