Freezable.CloneCurrentValue Freezable.CloneCurrentValue Freezable.CloneCurrentValue Freezable.CloneCurrentValue Method


创建的可修改复本 (深层副本)Freezable使用其当前值。Creates a modifiable clone (deep copy) of the Freezable using its current values.

 System::Windows::Freezable ^ CloneCurrentValue();
public System.Windows.Freezable CloneCurrentValue ();
member this.CloneCurrentValue : unit -> System.Windows.Freezable
Public Function CloneCurrentValue () As Freezable


当前对象的可修改复本。A modifiable clone of the current object. 即使源的 IsFrozen 属性为 true.,所克隆对象的 IsFrozen 属性也为 falseThe cloned object's IsFrozen property is false even if the source's IsFrozen property is true.


CloneCloneCurrentValue方法将产生的可修改克隆冻结Freezable对象 (方法还克隆Freezable未被冻结的对象)。The Clone and CloneCurrentValue methods produce modifiable clones of frozen Freezable objects (the methods also clone Freezable objects that are not frozen). 复本实际上是当前对象的深层副本。The clone is effectively a deep copy of the current object.

下表总结了之间的差异CloneCloneCurrentValue方法。The following table summarizes the differences between the Clone and CloneCurrentValue methods.

操作Action 克隆方法行为Clone method behavior CloneCurrentValue 方法行为CloneCurrentValue method behavior
复制包含的表达式的依赖项属性Copying a dependency property that has an expression 表达式复制,但可能不再解析。The expression is copied, but might no longer resolve. 有关详细信息,请参阅 Freezable 对象概述For more information, see Freezable Objects Overview. 复制当前表达式的值,但不是表达式本身。The current value of the expression is copied, but not the expression itself.
复制一个动画的依赖项属性Copying an animated dependency property 复制属性的基 (非动画的) 值。The property's base (non-animated) value is copied. 不复制动画。Animations are not copied. 复制属性的当前动画的值。The property's current animated value is copied. 不复制动画。Animations are not copied.

请注意,取消设置的属性将不会复制。Note that unset properties are not copied. 如果未设置的属性的默认值,则冻结Freezable,属性值保持在其他可修改复本冻结状态。If an unset property has a default value that is a frozen Freezable, that property value remains frozen in the otherwise modifiable clone.

Freezable 在线程间移动Move a Freezable Between Threads

此方法也可用于移动Freezable线程之间。This method can be useful for moving a Freezable between threads. 首先,请Freezable变为不可修改通过使用其Freeze方法。First, make the Freezable unmodifiable by using its Freeze method. 现在,另一个线程可以访问Freezable并使它可以访问的本地克隆。Now another thread can access the Freezable and make a local clone that it can access.


此方法使用CloneCurrentValueCore(Freezable)方法以生成克隆;Freezable实施者,他们重写CloneCurrentValueCore(Freezable)必须确保副本上创建未被冻结。This method uses the CloneCurrentValueCore(Freezable) method to produce the clone; Freezable implementers who override CloneCurrentValueCore(Freezable) must ensure that the copy is not frozen on creation.